mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Recalculate billing rows for 10 days (prev. 4)
This effectively reverts [^1], which was only a temporary change.
I suspect the performance problem will go away with [^2].
While we've clearly been managing without this change, it resulted
in several rows being left as incorrect when letter receipts were
delayed. It makes sense for us to run this task for the same period
as we do to aggregate statuses, as status affects billing.
[^1]: e5c76ffda7
[^2]: https://github.com/alphagov/notifications-api/pull/3542
This commit is contained in:
@@ -49,15 +49,15 @@ def mocker_get_rate(
|
||||
|
||||
@freeze_time('2019-08-01')
|
||||
@pytest.mark.parametrize('day_start, expected_kwargs', [
|
||||
(None, ['2019-07-31', '2019-07-30', '2019-07-29', '2019-07-28']),
|
||||
('2019-07-21', ['2019-07-21', '2019-07-20', '2019-07-19', '2019-07-18']),
|
||||
(None, [f'2019-07-{31-i}' for i in range(10)]),
|
||||
('2019-07-21', [f'2019-07-{21-i}' for i in range(10)]),
|
||||
])
|
||||
def test_create_nightly_billing_triggers_tasks_for_days(notify_api, mocker, day_start, expected_kwargs):
|
||||
mock_celery = mocker.patch('app.celery.reporting_tasks.create_nightly_billing_for_day')
|
||||
create_nightly_billing(day_start)
|
||||
|
||||
assert mock_celery.apply_async.call_count == 4
|
||||
for i in range(4):
|
||||
assert mock_celery.apply_async.call_count == 10
|
||||
for i in range(10):
|
||||
assert mock_celery.apply_async.call_args_list[i][1]['kwargs'] == {'process_day': expected_kwargs[i]}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user