add command to backfill template usage

The command takes a service id and a day, grabs the historical data for
that day (potentially out of notification_history), and pops it in
redis (for eight days, same as if it were written to manually).

also, prefix template usage key with "service" to make clear that it's
a service id, and not an individual template id.
This commit is contained in:
Leo Hemsted
2018-04-03 15:55:22 +01:00
parent 8e73961f65
commit 6e554188bd
3 changed files with 48 additions and 9 deletions

View File

@@ -80,7 +80,7 @@ def cache_key_for_service_template_counter(service_id, limit_days=7):
def cache_key_for_service_template_usage_per_day(service_id, datetime):
return "{}-template-usage-{}".format(service_id, datetime.date().isoformat())
return "service-{}-template-usage-{}".format(service_id, datetime.date().isoformat())
def get_public_notify_type_text(notify_type, plural=False):