mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 10:03:21 -04:00
finish up
This commit is contained in:
@@ -49,6 +49,7 @@ def old_service_dashboard(service_id):
|
|||||||
@main.route("/services/<uuid:service_id>")
|
@main.route("/services/<uuid:service_id>")
|
||||||
@user_has_permissions()
|
@user_has_permissions()
|
||||||
def service_dashboard(service_id):
|
def service_dashboard(service_id):
|
||||||
|
|
||||||
if session.get("invited_user_id"):
|
if session.get("invited_user_id"):
|
||||||
session.pop("invited_user_id", None)
|
session.pop("invited_user_id", None)
|
||||||
session["service_id"] = service_id
|
session["service_id"] = service_id
|
||||||
@@ -412,21 +413,13 @@ def get_dashboard_partials(service_id):
|
|||||||
|
|
||||||
|
|
||||||
def get_dashboard_totals(statistics):
|
def get_dashboard_totals(statistics):
|
||||||
# This is set in dashboard.html on page load
|
|
||||||
try:
|
|
||||||
timezone = request.cookies.get("timezone", "US/Eastern")
|
|
||||||
current_app.logger.debug(hilite(f"User's timezone is {timezone}"))
|
|
||||||
serialized_user = current_user.serialize()
|
|
||||||
if serialized_user["preferred_timezone"] is not timezone:
|
|
||||||
current_user.update(preferred_timezone=timezone)
|
|
||||||
except RuntimeError as e:
|
|
||||||
current_app.logger.warning(f"Can't get timezone, running tests? {e}")
|
|
||||||
|
|
||||||
for msg_type in statistics.values():
|
for msg_type in statistics.values():
|
||||||
msg_type["failed_percentage"] = get_formatted_percentage(
|
msg_type["failed_percentage"] = get_formatted_percentage(
|
||||||
msg_type["failed"], msg_type["requested"]
|
msg_type["failed"], msg_type["requested"]
|
||||||
)
|
)
|
||||||
msg_type["show_warning"] = float(msg_type["failed_percentage"]) > 3
|
msg_type["show_warning"] = float(msg_type["failed_percentage"]) > 3
|
||||||
|
|
||||||
return statistics
|
return statistics
|
||||||
|
|
||||||
|
|
||||||
@@ -485,6 +478,8 @@ def get_months_for_financial_year(year, time_format="%B"):
|
|||||||
|
|
||||||
|
|
||||||
def get_current_month_for_financial_year(year):
|
def get_current_month_for_financial_year(year):
|
||||||
|
# Setting the timezone here because we need to set it somewhere.
|
||||||
|
set_timezone()
|
||||||
current_month = datetime.now().month
|
current_month = datetime.now().month
|
||||||
return current_month
|
return current_month
|
||||||
|
|
||||||
@@ -557,3 +552,18 @@ def get_tuples_of_financial_years(
|
|||||||
)
|
)
|
||||||
for year in reversed(range(start, end + 1))
|
for year in reversed(range(start, end + 1))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def set_timezone():
|
||||||
|
# This is set in dashboard.html on page load
|
||||||
|
print(hilite("INVOKING set_timezone()!!!!"))
|
||||||
|
try:
|
||||||
|
timezone = request.cookies.get("timezone", "US/Eastern")
|
||||||
|
current_app.logger.debug(hilite(f"User's timezone is {timezone}"))
|
||||||
|
serialized_user = current_user.serialize()
|
||||||
|
if serialized_user["preferred_timezone"] is not timezone:
|
||||||
|
current_user.update(preferred_timezone=timezone)
|
||||||
|
except RuntimeError as e:
|
||||||
|
current_app.logger.exception(hilite(f"Can't get timezone, running tests?"))
|
||||||
|
except Exception as e:
|
||||||
|
current_app.logger.exception(hilite(f"Can't get timezone, running tests?"))
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
|
|
||||||
{% block service_page_title %}
|
{% block service_page_title %}
|
||||||
Dashboard
|
Dashboard
|
||||||
|
|
||||||
|
<script type="text/javascript" src="{{ asset_url('js/setTimezone.js') }}"></script>
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block maincolumn_content %}
|
{% block maincolumn_content %}
|
||||||
@@ -141,4 +145,3 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<script type="text/javascript" src="{{ asset_url('js/setTimezone.js') }}"></script>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user