mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 07:21:13 -05:00
Some code clean up, removed print statements.
This commit is contained in:
@@ -35,12 +35,8 @@ def get_template_statistics_for_service_by_day(service_id):
|
||||
|
||||
if limit_days == 7:
|
||||
stats = get_template_statistics_for_7_days(limit_days, service_id)
|
||||
print(stats)
|
||||
# [(UUID('c2a331f8-e0b9-43de-9dd2-88300511a1d7'), 'Create with priority', 'sms', 1)]
|
||||
|
||||
else:
|
||||
stats = dao_get_template_usage(service_id, limit_days=limit_days)
|
||||
print(stats)
|
||||
|
||||
def serialize(data):
|
||||
return {
|
||||
@@ -68,12 +64,10 @@ def get_template_statistics_for_7_days(limit_days, service_id):
|
||||
cache_key = "{}-template-counter-limit-7-days".format(service_id)
|
||||
template_stats_by_id = redis_store.get_all_from_hash(cache_key)
|
||||
if not template_stats_by_id:
|
||||
print("populate cache")
|
||||
stats = dao_get_template_usage(service_id, limit_days=limit_days)
|
||||
cache_values = dict([(x.template_id, x.count) for x in stats])
|
||||
redis_store.set_hash_and_expire(cache_key, cache_values, current_app.config.get('EXPIRE_CACHE_IN_SECONDS', 600))
|
||||
current_app.logger.info('use redis-client: {}'.format(cache_key))
|
||||
else:
|
||||
print("template_stats_by_id: {}".format(template_stats_by_id))
|
||||
stats = dao_get_templates_by_for_cache(template_stats_by_id.items())
|
||||
return stats
|
||||
|
||||
Reference in New Issue
Block a user