mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
Filter unbillable notifications before calculating
Notifications with a `billable_units` count of `0` wont have any effect on the result, but including them in the query will slow down the grouping and summing of the results because it’ll have to loop over more rows.
This commit is contained in:
@@ -221,6 +221,7 @@ def get_notification_billable_unit_count_per_month(service_id, year):
|
||||
).order_by(
|
||||
NotificationHistory.created_at
|
||||
).filter(
|
||||
NotificationHistory.billable_units != 0,
|
||||
NotificationHistory.service_id == service_id,
|
||||
NotificationHistory.created_at >= start,
|
||||
NotificationHistory.created_at < end
|
||||
|
||||
Reference in New Issue
Block a user