mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-19 14:04:20 -04:00
This is a bit gnarly. When querying the notifications table for template usage, we don't apply the days limit if we're trying to get exactly 7 days.
This is because 7days should be the amount of data in that table so don't restrict. Note not all queries do this in the same way and a pivotal bug has been raised to align this. This is a bug fix as right now the numbers are out in prod.
This commit is contained in:
@@ -109,7 +109,9 @@ def dao_get_template_usage(service_id, limit_days=None):
|
||||
table = Notification
|
||||
|
||||
query_filter = [table.service_id == service_id, table.key_type != KEY_TYPE_TEST]
|
||||
if limit_days is not None:
|
||||
|
||||
# only limit days if it's not seven days, as 7 days == the whole of Notifications table.
|
||||
if limit_days is not None and limit_days != 7:
|
||||
query_filter.append(table.created_at >= days_ago(limit_days))
|
||||
|
||||
notifications_aggregate_query = db.session.query(
|
||||
|
||||
Reference in New Issue
Block a user