Need to be able to query the notification statistics for the right number of days.

If the request is for the big numbers on the activity page, then we need to use the number right number of days.
Added an end point to get the data retention for the service and notification type, which is needed on the activity page to say how long the report is available for.
This commit is contained in:
Rebecca Law
2018-07-19 17:06:46 +01:00
parent dae29a1b61
commit 0675f09afb
5 changed files with 64 additions and 21 deletions

View File

@@ -246,9 +246,8 @@ def delete_service_and_all_associated_db_objects(service):
@statsd(namespace="dao")
def dao_fetch_stats_for_service(service_id):
# We always want between seven and eight days
start_date = midnight_n_days_ago(7)
def dao_fetch_stats_for_service(service_id, limit_days):
start_date = midnight_n_days_ago(limit_days)
return _stats_for_service_query(service_id).filter(
Notification.created_at >= start_date
).all()