mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 17:01:35 -05:00
Refactor the get_midnight functions to return the date in UTC but for the localised time.
So in June when we are in BST June 16, 00:00 BST => June 15 23:00 UTC
This commit is contained in:
@@ -53,7 +53,7 @@ from app.schemas import (
|
||||
notifications_filter_schema,
|
||||
detailed_service_schema
|
||||
)
|
||||
from app.utils import pagination_links
|
||||
from app.utils import pagination_links, get_london_midnight_in_utc
|
||||
|
||||
service_blueprint = Blueprint('service', __name__)
|
||||
register_errors(service_blueprint)
|
||||
@@ -281,8 +281,9 @@ def get_detailed_services(start_date, end_date, only_active=False, include_from_
|
||||
if start_date == datetime.utcnow().date():
|
||||
stats = dao_fetch_todays_stats_for_all_services(include_from_test_key=include_from_test_key)
|
||||
else:
|
||||
stats = fetch_stats_by_date_range_for_all_services(start_date=start_date,
|
||||
end_date=end_date,
|
||||
|
||||
stats = fetch_stats_by_date_range_for_all_services(start_date=get_london_midnight_in_utc(start_date),
|
||||
end_date=get_london_midnight_in_utc(end_date),
|
||||
include_from_test_key=include_from_test_key)
|
||||
|
||||
for service_id, rows in itertools.groupby(stats, lambda x: x.service_id):
|
||||
|
||||
Reference in New Issue
Block a user