Add notification_type to query

This commit is contained in:
Rebecca Law
2018-04-27 15:15:55 +01:00
parent 8e2e94ca12
commit 0fb9c1d318
3 changed files with 119 additions and 23 deletions

View File

@@ -20,7 +20,7 @@ from app.models import (
from app.utils import convert_utc_to_bst, convert_bst_to_utc
def fetch_montly_billing_for_year(service_id, year):
def fetch_monthly_billing_for_year(service_id, year):
year_start_date, year_end_date = get_financial_year(year)
utcnow = datetime.utcnow()
today = convert_utc_to_bst(utcnow).date()
@@ -39,7 +39,8 @@ def fetch_montly_billing_for_year(service_id, year):
FactBilling.service_id,
FactBilling.rate,
FactBilling.rate_multiplier,
FactBilling.international
FactBilling.international,
FactBilling.notification_type
).filter(
FactBilling.service_id == service_id,
FactBilling.bst_date >= year_start_date,
@@ -49,7 +50,12 @@ def fetch_montly_billing_for_year(service_id, year):
FactBilling.service_id,
FactBilling.rate,
FactBilling.rate_multiplier,
FactBilling.international
FactBilling.international,
FactBilling.notification_type
).order_by(
FactBilling.service_id,
'Month',
FactBilling.notification_type
).all()
return yearly_data