london → local

This commit is contained in:
stvnrlly
2022-11-16 14:11:52 -05:00
parent 052f911ca8
commit e6d30394ba
3 changed files with 4 additions and 4 deletions

View File

@@ -29,7 +29,7 @@ from app.models import (
)
from app.utils import (
get_local_midnight_in_utc,
get_london_month_from_utc_column,
get_local_month_from_utc_column,
midnight_n_days_ago,
)
@@ -360,7 +360,7 @@ def fetch_monthly_template_usage_for_service(start_date, end_date, service_id):
if start_date <= datetime.utcnow() <= end_date:
today = get_local_midnight_in_utc(datetime.utcnow())
month = get_london_month_from_utc_column(Notification.created_at)
month = get_local_month_from_utc_column(Notification.created_at)
stats_for_today = db.session.query(
Notification.template_id.label('template_id'),

View File

@@ -71,7 +71,7 @@ def get_midnight_for_day_before(date):
return get_local_midnight_in_utc(day_before)
def get_london_month_from_utc_column(column):
def get_local_month_from_utc_column(column):
"""
Where queries need to count notifications by month it needs to be
the month in local time.

View File

@@ -670,7 +670,7 @@ def test_create_nightly_notification_status_for_service_and_day_overwrites_old_d
assert updated_fact_data[1].notification_status == 'delivered'
# the job runs at 12:30am London time. 04/01 is in BST.
# the job runs at 04:30am EST time.
@freeze_time('2019-04-02T04:30')
def test_create_nightly_notification_status_for_service_and_day_respects_bst(sample_template):
create_notification(sample_template, status='delivered', created_at=datetime(2019, 4, 2, 5, 0)) # too new