Update ft_billing DAO functions to use postage

* Updated the 'fetch_billing_data_for_day' DAO function to take postage into
account
* Updated the 'update_fact_billing' DAO function to insert postage for
new rows. When updating rows which are identical apart from the postage, the
original row will be kept. (This behaviour will change once postage is
added to the primary key - at this point, upserting will add a new row.)
* Also changed some fixtures / test set up functions to take postage
into account
This commit is contained in:
Katie Smith
2018-09-26 11:28:59 +01:00
parent 0b5da2b8ad
commit 6727f0e0f5
6 changed files with 95 additions and 14 deletions

View File

@@ -535,7 +535,8 @@ def sample_notification(
client_reference=None,
rate_multiplier=1.0,
scheduled_for=None,
normalised_to=None
normalised_to=None,
postage=None,
):
if created_at is None:
created_at = datetime.utcnow()
@@ -580,7 +581,8 @@ def sample_notification(
'updated_at': created_at if status in NOTIFICATION_STATUS_TYPES_COMPLETED else None,
'client_reference': client_reference,
'rate_multiplier': rate_multiplier,
'normalised_to': normalised_to
'normalised_to': normalised_to,
'postage': postage,
}
if job_row_number is not None:
data['job_row_number'] = job_row_number