mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
add new tests for template statistics
This commit is contained in:
@@ -67,7 +67,7 @@ def get_template_statistics_for_last_n_days(service_id, limit_days):
|
||||
if not stats:
|
||||
# key didn't exist (or redis was down) - lets populate from DB.
|
||||
stats = {
|
||||
row.id: row.count for row in dao_get_template_usage(service_id, day=day)
|
||||
str(row.id): row.count for row in dao_get_template_usage(service_id, day=day)
|
||||
}
|
||||
|
||||
template_stats_by_id += Counter(stats)
|
||||
@@ -76,7 +76,7 @@ def get_template_statistics_for_last_n_days(service_id, limit_days):
|
||||
template_details = dao_get_multiple_template_details(template_stats_by_id.keys())
|
||||
return [
|
||||
{
|
||||
'count': template_stats_by_id[template.id],
|
||||
'count': template_stats_by_id[str(template.id)],
|
||||
'template_id': str(template.id),
|
||||
'template_name': template.name,
|
||||
'template_type': template.template_type,
|
||||
|
||||
@@ -104,8 +104,8 @@ def days_ago(number_of_days):
|
||||
|
||||
def last_n_days(limit_days):
|
||||
"""
|
||||
Returns the last n dates, oldest first. Takes care of daylight savings (but returns a date, be careful how you manipulate it later! Don't
|
||||
directly use the date for comparing to UTC datetimes!). Includes today.
|
||||
Returns the last n dates, oldest first. Takes care of daylight savings (but returns a date, be careful how you
|
||||
manipulate it later! Don't directly use the date for comparing to UTC datetimes!). Includes today.
|
||||
"""
|
||||
return [
|
||||
datetime.combine(
|
||||
|
||||
Reference in New Issue
Block a user