code review feedback

This commit is contained in:
Kenneth Kehl
2023-06-01 07:07:10 -07:00
parent 80c6c677db
commit 15a70460bc
2 changed files with 5 additions and 6 deletions

View File

@@ -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(