mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 06:21:50 -05:00
more fix
This commit is contained in:
@@ -28,8 +28,8 @@ from app.models import (
|
||||
Template,
|
||||
)
|
||||
from app.utils import (
|
||||
get_local_month_from_utc_column,
|
||||
get_midnight_in_utc,
|
||||
get_month_from_utc_column,
|
||||
midnight_n_days_ago,
|
||||
)
|
||||
|
||||
@@ -358,7 +358,7 @@ def fetch_monthly_template_usage_for_service(start_date, end_date, service_id):
|
||||
|
||||
if start_date <= datetime.utcnow() <= end_date:
|
||||
today = get_midnight_in_utc(datetime.utcnow())
|
||||
month = get_local_month_from_utc_column(Notification.created_at)
|
||||
month = get_month_from_utc_column(Notification.created_at)
|
||||
|
||||
stats_for_today = db.session.query(
|
||||
Notification.template_id.label('template_id'),
|
||||
|
||||
@@ -63,7 +63,7 @@ def get_midnight_for_day_before(date):
|
||||
return get_midnight_in_utc(day_before)
|
||||
|
||||
|
||||
def get_local_month_from_utc_column(column):
|
||||
def get_month_from_utc_column(column):
|
||||
"""
|
||||
Where queries need to count notifications by month it needs to be
|
||||
the month in local time.
|
||||
@@ -75,7 +75,7 @@ def get_local_month_from_utc_column(column):
|
||||
"""
|
||||
return func.date_trunc(
|
||||
"month",
|
||||
func.timezone(getenv("TIMEZONE", "America/New_York"), func.timezone("UTC", column))
|
||||
func.timezone(getenv("TIMEZONE", "UTC"), func.timezone("UTC", column))
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user