Merge pull request #2268 from GSA/notify-admin-2245

get rid of some noise in status updates
This commit is contained in:
Kenneth Kehl
2025-01-20 11:27:09 -08:00
committed by GitHub
7 changed files with 46 additions and 18 deletions

View File

@@ -32,11 +32,7 @@ def check_feature_flags():
@main.route("/test/feature-flags")
def test_feature_flags():
return jsonify(
{
"FEATURE_ABOUT_PAGE_ENABLED": current_app.config[
"FEATURE_ABOUT_PAGE_ENABLED"
]
}
{"FEATURE_ABOUT_PAGE_ENABLED": current_app.config["FEATURE_ABOUT_PAGE_ENABLED"]}
)
@@ -235,7 +231,6 @@ def contact():
return render_template(
"views/contact.html",
navigation_links=about_notify_nav(),
)
@@ -268,7 +263,6 @@ def join_notify():
return render_template(
"views/join-notify.html",
navigation_links=about_notify_nav(),
)

View File

@@ -1,3 +1,6 @@
import json
from app.extensions import redis_client
from app.notify_client import NotifyAdminAPIClient
@@ -15,10 +18,19 @@ class BillingAPIClient(NotifyAdminAPIClient):
)
def get_free_sms_fragment_limit_for_year(self, service_id, year=None):
frag_limit = redis_client.get(f"free-sms-fragment-limit-{service_id}-{year}")
if frag_limit is not None:
return json.loads(frag_limit.decode("utf-8"))
result = self.get(
"/service/{0}/billing/free-sms-fragment-limit".format(service_id),
params=dict(financial_year_start=year),
)
redis_client.set(
f"free-sms-fragment-limit-{service_id}-{year}",
json.dumps(result["free_sms_fragment_limit"]),
ex=30,
)
return result["free_sms_fragment_limit"]
def create_or_update_free_sms_fragment_limit(

View File

@@ -1,3 +1,4 @@
import json
from datetime import datetime, timezone
from app.extensions import redis_client
@@ -517,7 +518,18 @@ class ServiceAPIClient(NotifyAdminAPIClient):
return int(count)
def get_global_notification_count(self, service_id):
return self.get("/service/{}/notification-count".format(service_id))
notification_count = redis_client.get(f"notification-count-{service_id}")
if notification_count is not None:
return json.loads(notification_count.decode("utf-8"))
notification_count = self.get(
"/service/{}/notification-count".format(service_id)
)
redis_client.set(
f"notification-count-{service_id}", json.dumps(notification_count), ex=30
)
return notification_count
def get_service_invite_data(self, redis_key):
"""