mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 08:16:51 -04:00
Added global remaining daily messages across services to ui
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user