diff --git a/lacommunaute/pages/tests/tests.py b/lacommunaute/pages/tests/tests.py index 435f28183..61be2e38a 100644 --- a/lacommunaute/pages/tests/tests.py +++ b/lacommunaute/pages/tests/tests.py @@ -101,7 +101,6 @@ def test_impact_in_context_data(self): # undesired data StatFactory(name="nb_uniq_visitors_returning", period=Period.DAY, date=today) StatFactory(name=faker.word(), period=Period.MONTH, date=today) - StatFactory(name="nb_uniq_visitors_returning", period=Period.MONTH, date=today - timezone.timedelta(days=125)) response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertEqual(response.context["impact"], empty_res) diff --git a/lacommunaute/pages/views.py b/lacommunaute/pages/views.py index 37ee0981a..4eee58d66 100644 --- a/lacommunaute/pages/views.py +++ b/lacommunaute/pages/views.py @@ -67,9 +67,8 @@ def get_daily_stats(self): def get_monthly_visitors(self): indicator_names = ["nb_uniq_visitors_returning"] - after_date = timezone.now() - timezone.timedelta(days=124) # 4 months datas = ( - Stat.objects.filter(period="month", name__in=indicator_names, date__gte=after_date) + Stat.objects.filter(period="month", name__in=indicator_names) .values("name", "value") .annotate(date=Cast("date", CharField())) )