mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-04 05:20:46 -04:00
Requested changes in PR review
This commit is contained in:
@@ -315,7 +315,7 @@ def init_app(application):
|
||||
def _attach_current_daily_remaining_messages_per_service():
|
||||
remaining_messages = 0
|
||||
|
||||
if hasattr(current_service, 'message_limit'):
|
||||
if current_service:
|
||||
remaining_messages = current_service.message_limit - service_api_client.get_notification_count(
|
||||
service_id=current_service.id)
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ def get_example_csv_rows(template, use_example_as_example=True, submitted_fields
|
||||
@user_has_permissions('send_messages', restrict_admin_usage=True)
|
||||
def send_messages(service_id, template_id):
|
||||
notification_count = service_api_client.get_notification_count(service_id)
|
||||
remaining_messages = (current_service.message_limit - notification_count)
|
||||
remaining_messages = current_service.message_limit - notification_count
|
||||
|
||||
db_template = current_service.get_template_with_user_permission_or_403(template_id, current_user)
|
||||
|
||||
|
||||
@@ -530,14 +530,12 @@ class ServiceAPIClient(NotifyAdminAPIClient):
|
||||
|
||||
def get_notification_count(self, service_id):
|
||||
# if cache is not set, or not enabled, return 0
|
||||
|
||||
count = redis_client.get(daily_limit_cache_key(service_id)) or 0
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user