Adjust get_service_stats to get counts for a maximum of 7 days ago

This commit is contained in:
chrisw
2018-04-24 14:05:48 +01:00
parent 0ceed13bee
commit c157de82c4
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")