mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
split up _query_for_billing_data into three separate queries
the queries all return lots of columns, but each query has columns it doesn't care about. eg emails don't have billable units or international flag, letters don't have international flag, sms don't have a page count etc. additionally, the query was grouping on things that never change, like service id and notification type. by making all of these literals (as in `select 1 as foo`) we see times that are over 50% quicker for gov.uk email service. Note: One of the tests changed because previously it involved emails and sms with statuses that they could never be (eg returned-letter)
This commit is contained in:
@@ -166,6 +166,7 @@ def test_create_nightly_billing_for_day_different_templates(
|
||||
multiplier = [0, 1]
|
||||
billable_units = [0, 1]
|
||||
rate = [0, Decimal(1.33)]
|
||||
|
||||
for i, record in enumerate(records):
|
||||
assert record.bst_date == datetime.date(yesterday)
|
||||
assert record.rate == rate[i]
|
||||
|
||||
Reference in New Issue
Block a user