mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
Add limit_days argument to notification statistics endpoint
Allows getting notification counts for a given number of days to support services with custom data retention periods (admin dashboard page should still display counts for the last 7 days, while the notifications page displays all stored notifications).
This commit is contained in:
@@ -246,9 +246,9 @@ def delete_service_and_all_associated_db_objects(service):
|
||||
|
||||
|
||||
@statsd(namespace="dao")
|
||||
def dao_fetch_stats_for_service(service_id):
|
||||
def dao_fetch_stats_for_service(service_id, limit_days):
|
||||
# We always want between seven and eight days
|
||||
start_date = midnight_n_days_ago(7)
|
||||
start_date = midnight_n_days_ago(limit_days)
|
||||
return _stats_for_service_query(service_id).filter(
|
||||
Notification.created_at >= start_date
|
||||
).all()
|
||||
|
||||
Reference in New Issue
Block a user