Use the end date for the month, when we are in BST the first day of the month is an hour behind and in the previous month.

This commit is contained in:
Rebecca Law
2017-07-25 18:08:46 +01:00
parent f73b5140ed
commit 9c55fa7f34

View File

@@ -26,7 +26,7 @@ def create_or_update_monthly_billing_sms(service_id, billing_month):
# update monthly
monthly_totals = _monthly_billing_data_to_json(monthly)
row = MonthlyBilling.query.filter_by(year=billing_month.year,
month=datetime.strftime(billing_month, "%B"),
month=datetime.strftime(end_date, "%B"),
notification_type='sms').first()
if row:
row.monthly_totals = monthly_totals
@@ -34,7 +34,7 @@ def create_or_update_monthly_billing_sms(service_id, billing_month):
row = MonthlyBilling(service_id=service_id,
notification_type=SMS_TYPE,
year=billing_month.year,
month=datetime.strftime(billing_month, "%B"),
month=datetime.strftime(end_date, "%B"),
monthly_totals=monthly_totals)
db.session.add(row)