- Only rebuild current month for monthly_billing if today is in the current year.

- Change the usage queries to a union so that billing_units is correct for all notification types. Removing the business logic from the schema.
- Added tests for different fragment counts, rates and sheet counts.
This commit is contained in:
Rebecca Law
2018-05-16 12:21:59 +01:00
parent e3179dee99
commit eb083e30ed
6 changed files with 224 additions and 30 deletions

View File

@@ -16,12 +16,12 @@ create_or_update_free_sms_fragment_limit_schema = {
def serialize_ft_billing_remove_emails(data):
results = []
billed_notifications = [x for x in data if x.notification_type != 'email']
for notifications in billed_notifications:
for notification in billed_notifications:
json_result = {
"month": (datetime.strftime(notifications.month, "%B")),
"notification_type": notifications.notification_type,
"billing_units": int(notifications.billable_units),
"rate": float(notifications.rate),
"month": (datetime.strftime(notification.month, "%B")),
"notification_type": notification.notification_type,
"billing_units": notification.billable_units,
"rate": float(notification.rate),
}
results.append(json_result)
return results