Because dates are confusing we need to fix this query once more.

The template statistics are returning 7 days inclusive, however the big numbers on the dashboard are for 8 days.
This PR fixes that.
This commit is contained in:
Rebecca Law
2018-05-01 10:47:47 +01:00
parent ea2fd286b5
commit 93c7ab6251
2 changed files with 6 additions and 4 deletions

View File

@@ -251,8 +251,10 @@ def delete_service_and_all_associated_db_objects(service):
@statsd(namespace="dao")
def dao_fetch_stats_for_service(service_id):
# We want 7 days inclusive
start_date = get_london_midnight_in_utc(date.today() - timedelta(days=6))
return _stats_for_service_query(service_id).filter(
func.date(Notification.created_at) >= date.today() - timedelta(days=7)
func.date(Notification.created_at) >= start_date
).all()