mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-18 13:40:31 -04:00
make has_delete_task_run non-optional
just to ensure people think about the value of it when using the function
This commit is contained in:
@@ -311,7 +311,7 @@ def fetch_billing_data_for_day(process_day, service_id=None):
|
||||
|
||||
for service in services:
|
||||
for notification_type in (SMS_TYPE, EMAIL_TYPE, LETTER_TYPE):
|
||||
table = get_notification_table_to_use(service, notification_type, process_day)
|
||||
table = get_notification_table_to_use(service, notification_type, process_day, has_delete_task_run=False)
|
||||
|
||||
results = _query_for_billing_data(
|
||||
table=table,
|
||||
|
||||
@@ -49,7 +49,7 @@ def fetch_notification_status_for_day(process_day):
|
||||
# if no rows try notificationHistory
|
||||
for service in services:
|
||||
for notification_type in [EMAIL_TYPE, SMS_TYPE, LETTER_TYPE]:
|
||||
table = get_notification_table_to_use(service, notification_type, process_day)
|
||||
table = get_notification_table_to_use(service, notification_type, process_day, has_delete_task_run=False)
|
||||
|
||||
data_for_service_and_type = query_for_fact_status_data(
|
||||
table=table,
|
||||
|
||||
@@ -115,12 +115,13 @@ def email_address_is_nhs(email_address):
|
||||
))
|
||||
|
||||
|
||||
def get_notification_table_to_use(service, notification_type, process_day, has_delete_task_run=False):
|
||||
def get_notification_table_to_use(service, notification_type, process_day, has_delete_task_run):
|
||||
"""
|
||||
Work out what table will contain notification data for a service by looking up their data retention.
|
||||
|
||||
Make sure that when you run this you think about whether the delete task has run for that day! If it's run, the
|
||||
notifications from that day will have moved to NotificationHistory. By default we assume it hasn't run, since
|
||||
notifications from that day will have moved to NotificationHistory. The delete tasks run between 4 and 5am every
|
||||
morning.
|
||||
"""
|
||||
from app.models import Notification, NotificationHistory
|
||||
|
||||
|
||||
Reference in New Issue
Block a user