Split out handling of BST queries for reuse

This commit is contained in:
Chris Hill-Scott
2017-01-30 16:46:47 +00:00
parent 8381a5e11c
commit 45b505f379
3 changed files with 22 additions and 17 deletions

View File

@@ -30,6 +30,7 @@ from app.models import (
TEMPLATE_TYPES,
)
from app.statsd_decorators import statsd
from app.utils import get_london_month_from_utc_column
def dao_fetch_all_services(only_active=False):
@@ -247,13 +248,7 @@ def dao_fetch_monthly_historical_stats_for_service(service_id, year):
monday_of_notification_week = func.date_trunc('week', NotificationHistory.created_at).label('week_start')
start, end = get_financial_year(year)
month = func.date_trunc(
"month",
func.timezone(
"Europe/London",
func.timezone("UTC", NotificationHistory.created_at)
)
)
month = get_london_month_from_utc_column(NotificationHistory.created_at)
rows = db.session.query(
NotificationHistory.notification_type,