Refactored code, changed now to utcnow in test

This commit is contained in:
Ken Tsang
2017-03-29 11:47:41 +01:00
parent c94b4f1b46
commit 5f945ab30e
3 changed files with 10 additions and 11 deletions

View File

@@ -31,7 +31,7 @@ from app.models import (
)
from app.service.statistics import format_monthly_template_notification_stats
from app.statsd_decorators import statsd
from app.utils import get_london_month_from_utc_column
from app.utils import get_london_month_from_utc_column, get_london_midnight_in_utc
def dao_fetch_all_services(only_active=False):
@@ -324,9 +324,8 @@ def dao_fetch_todays_stats_for_all_services(include_from_test_key=True):
@statsd(namespace='dao')
def fetch_stats_by_date_range_for_all_services(start_date, end_date, include_from_test_key=True):
if not isinstance(end_date, datetime):
end_date = datetime.combine(end_date, datetime.min.time())
start_date = get_london_midnight_in_utc(start_date)
end_date = get_london_midnight_in_utc(end_date)
end_date += timedelta(hours=23, minutes=59, seconds=59)
query = db.session.query(