Added global remaining daily messages across services to ui

This commit is contained in:
Andrew Shumway
2023-06-01 10:44:13 -06:00
parent 3abb61614c
commit bd798e78b6
8 changed files with 43 additions and 20 deletions

View File

@@ -1,6 +1,9 @@
from datetime import datetime
from notifications_utils.clients.redis import daily_limit_cache_key
from notifications_utils.clients.redis import (
daily_limit_cache_key,
daily_total_cache_key,
)
from app.extensions import redis_client
from app.notify_client import NotifyAdminAPIClient, _attach_current_user, cache
@@ -532,5 +535,12 @@ class ServiceAPIClient(NotifyAdminAPIClient):
return int(count)
def get_global_notification_count(self):
# if cache is not set, or not enabled, return 0
count = redis_client.get(daily_total_cache_key()) or 0
return int(count)
service_api_client = ServiceAPIClient()