mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-07 19:28:25 -04:00
Add notif count and history count together
This commit is contained in:
committed by
Carlo Costino
parent
2fbda1cd0c
commit
81f4b1436d
@@ -285,12 +285,13 @@ def init_app(application):
|
|||||||
@application.context_processor
|
@application.context_processor
|
||||||
def _attach_current_global_daily_messages():
|
def _attach_current_global_daily_messages():
|
||||||
remaining_global_messages = 0
|
remaining_global_messages = 0
|
||||||
|
|
||||||
if current_app:
|
if current_app:
|
||||||
service_id = session.get("service_id")
|
service_id = session.get("service_id")
|
||||||
global_limit = current_app.config["GLOBAL_SERVICE_MESSAGE_LIMIT"]
|
|
||||||
global_messages_count = service_api_client.get_global_notification_count(service_id)
|
if service_id:
|
||||||
remaining_global_messages = global_limit - global_messages_count
|
global_limit = current_app.config["GLOBAL_SERVICE_MESSAGE_LIMIT"]
|
||||||
|
global_messages_count = service_api_client.get_global_notification_count(service_id)
|
||||||
|
remaining_global_messages = global_limit - global_messages_count.get("count")
|
||||||
return {"daily_global_messages_remaining": remaining_global_messages}
|
return {"daily_global_messages_remaining": remaining_global_messages}
|
||||||
|
|
||||||
@application.before_request
|
@application.before_request
|
||||||
|
|||||||
@@ -498,7 +498,7 @@ class ServiceAPIClient(NotifyAdminAPIClient):
|
|||||||
return int(count)
|
return int(count)
|
||||||
|
|
||||||
def get_global_notification_count(self, service_id):
|
def get_global_notification_count(self, service_id):
|
||||||
return self.get("/service/{}/notification-count".format(service_id))
|
return self.get("/service/{}/notification-count".format(service_id))
|
||||||
|
|
||||||
|
|
||||||
service_api_client = ServiceAPIClient()
|
service_api_client = ServiceAPIClient()
|
||||||
|
|||||||
Reference in New Issue
Block a user