Remove the delete query when updating the ft_billing. It's in the wrong place and we also should not need it.

This commit is contained in:
Rebecca Law
2019-07-18 16:24:06 +01:00
parent ed611f982c
commit a52c65ea29
2 changed files with 15 additions and 10 deletions

View File

@@ -159,7 +159,7 @@ def fetch_billing_data_for_day(process_day, service_id=None):
notification_type=notification_type,
start_date=start_date,
end_date=end_date,
service_id = id_of_service
service_id=id_of_service
)
# If data has been purged from Notification then use NotificationHistory
if len(results) == 0:
@@ -285,10 +285,6 @@ def update_fact_billing(data, process_day):
data.postage)
billing_record = create_billing_record(data, rate, process_day)
FactBilling.query.filter(
FactBilling.bst_date == process_day
).delete()
table = FactBilling.__table__
'''
This uses the Postgres upsert to avoid race conditions when two threads try to insert