Removed the end date in the filter.

It's always going to be in the future anyway.
After some analysis the query does perform better without it.
I'll make a note to update other queries where we get todays
notification data to remove the end date filter in a separate PR.
This commit is contained in:
Rebecca Law
2021-05-26 13:47:53 +01:00
parent dfacba5053
commit ed5e3b3d9c

View File

@@ -431,10 +431,8 @@ def dao_fetch_stats_for_service(service_id, limit_days):
def dao_fetch_todays_stats_for_service(service_id):
today = date.today()
start_date = get_london_midnight_in_utc(today)
end_date = get_london_midnight_in_utc(today + timedelta(days=1))
return _stats_for_service_query(service_id).filter(
Notification.created_at >= start_date,
Notification.created_at < end_date
Notification.created_at >= start_date
).all()