Merge pull request #1839 from alphagov/make-service-stats-7-days-max

Adjust get_service_stats to get counts for a maximum of 7 days ago
This commit is contained in:
Chris Waszczuk
2018-04-26 15:10:40 +01:00
committed by GitHub
2 changed files with 26 additions and 1 deletions

View File

@@ -251,7 +251,9 @@ def delete_service_and_all_associated_db_objects(service):
@statsd(namespace="dao")
def dao_fetch_stats_for_service(service_id):
return _stats_for_service_query(service_id).all()
return _stats_for_service_query(service_id).filter(
func.date(Notification.created_at) >= date.today() - timedelta(days=7)
).all()
@statsd(namespace="dao")