From cff731c52d20f2ad14fac3ee0c279770a96546ac Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Wed, 25 Apr 2018 16:17:56 +0100 Subject: [PATCH] Set filter on query --- app/dao/fact_billing_dao.py | 2 +- tests/app/dao/test_ft_billing_dao.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/dao/fact_billing_dao.py b/app/dao/fact_billing_dao.py index a0d9fc922..58c62d2a6 100644 --- a/app/dao/fact_billing_dao.py +++ b/app/dao/fact_billing_dao.py @@ -94,7 +94,7 @@ def fetch_billing_data_for_day(process_day, service_id=None): Service ) if service_id: - transit_data.filter(Notification.service_id == service_id) + transit_data = transit_data.filter(Notification.service_id == service_id) return transit_data.all() diff --git a/tests/app/dao/test_ft_billing_dao.py b/tests/app/dao/test_ft_billing_dao.py index 091924f29..e0a69715a 100644 --- a/tests/app/dao/test_ft_billing_dao.py +++ b/tests/app/dao/test_ft_billing_dao.py @@ -165,7 +165,8 @@ def test_get_rate(notify_db_session): create_rate(start_date=datetime.utcnow(), value=3.3, notification_type='email') create_letter_rate(start_date=datetime.utcnow(), rate=4.4) non_letter_rates, letter_rates = get_rates_for_billing() - rate = get_rate(non_letter_rates=non_letter_rates, letter_rates=letter_rates, notification_type='sms', date=datetime.utcnow()) + rate = get_rate(non_letter_rates=non_letter_rates, letter_rates=letter_rates, notification_type='sms', + date=datetime.utcnow()) letter_rate = get_rate(non_letter_rates=non_letter_rates, letter_rates=letter_rates, notification_type='letter', crown=True,