From 15a70460bc38d057555675c5e7f84fa3c2a7970a Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Thu, 1 Jun 2023 07:07:10 -0700 Subject: [PATCH] code review feedback --- app/dao/fact_notification_status_dao.py | 8 ++++---- app/utils.py | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/dao/fact_notification_status_dao.py b/app/dao/fact_notification_status_dao.py index 923ad9ad0..857256cd3 100644 --- a/app/dao/fact_notification_status_dao.py +++ b/app/dao/fact_notification_status_dao.py @@ -104,16 +104,16 @@ def fetch_notification_status_for_service_by_month(start_date, end_date, service ).all() -def fetch_notification_status_for_service_for_day(bst_day, service_id): +def fetch_notification_status_for_service_for_day(fetch_day, service_id): return db.session.query( # return current month as a datetime so the data has the same shape as the ft_notification_status query - literal(bst_day.replace(day=1), type_=DateTime).label('month'), + literal(fetch_day.replace(day=1), type_=DateTime).label('month'), Notification.notification_type, Notification.status.label('notification_status'), func.count().label('count') ).filter( - Notification.created_at >= get_midnight_in_utc(bst_day), - Notification.created_at < get_midnight_in_utc(bst_day + timedelta(days=1)), + Notification.created_at >= get_midnight_in_utc(fetch_day), + Notification.created_at < get_midnight_in_utc(fetch_day + timedelta(days=1)), Notification.service_id == service_id, Notification.key_type != KEY_TYPE_TEST ).group_by( diff --git a/app/utils.py b/app/utils.py index 97cc01673..94d4ac576 100644 --- a/app/utils.py +++ b/app/utils.py @@ -1,5 +1,4 @@ from datetime import datetime, timedelta -from os import getenv from flask import url_for from notifications_utils.template import HTMLEmailTemplate, SMSMessageTemplate @@ -75,7 +74,7 @@ def get_month_from_utc_column(column): """ return func.date_trunc( "month", - func.timezone(getenv("TIMEZONE", "UTC"), func.timezone("UTC", column)) + func.timezone("UTC", func.timezone("UTC", column)) )