mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 10:03:21 -04:00
Disabled the template_history endpoint
- Removed the code for the template_history endpoint and replaced with a redirect to the new page so that anyone is forwarded on - Updated the template to point to the new template_usage page
This commit is contained in:
@@ -12,6 +12,7 @@ from flask import (
|
|||||||
)
|
)
|
||||||
from flask_login import login_required
|
from flask_login import login_required
|
||||||
from notifications_utils.recipients import format_phone_number_human_readable
|
from notifications_utils.recipients import format_phone_number_human_readable
|
||||||
|
from werkzeug.routing import RequestRedirect
|
||||||
|
|
||||||
from app.main import main
|
from app.main import main
|
||||||
from app import (
|
from app import (
|
||||||
@@ -75,35 +76,7 @@ def service_dashboard_updates(service_id):
|
|||||||
@user_has_permissions('view_activity', admin_override=True)
|
@user_has_permissions('view_activity', admin_override=True)
|
||||||
def template_history(service_id):
|
def template_history(service_id):
|
||||||
|
|
||||||
year, current_financial_year = requested_and_current_financial_year(request)
|
raise RequestRedirect("/services/{}/template-usage".format(service_id))
|
||||||
stats = template_statistics_client.get_monthly_template_statistics_for_service(service_id, year)
|
|
||||||
|
|
||||||
months = [
|
|
||||||
{
|
|
||||||
'name': yyyy_mm_to_datetime(month).strftime('%B'),
|
|
||||||
'templates_used': aggregate_usage(
|
|
||||||
format_template_stats_to_list(stats.get(month)), sort_key='requested_count'
|
|
||||||
),
|
|
||||||
}
|
|
||||||
for month in get_months_for_financial_year(year, time_format='%Y-%m')
|
|
||||||
]
|
|
||||||
|
|
||||||
return render_template(
|
|
||||||
'views/dashboard/all-template-statistics.html',
|
|
||||||
months=months,
|
|
||||||
most_used_template_count=max(
|
|
||||||
max((
|
|
||||||
template['requested_count']
|
|
||||||
for template in month['templates_used']
|
|
||||||
), default=0)
|
|
||||||
for month in months
|
|
||||||
),
|
|
||||||
years=get_tuples_of_financial_years(
|
|
||||||
partial(url_for, '.template_history', service_id=service_id),
|
|
||||||
end=current_financial_year,
|
|
||||||
),
|
|
||||||
selected_year=year,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@main.route("/services/<service_id>/template-usage")
|
@main.route("/services/<service_id>/template-usage")
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
{% if partials['has_template_statistics'] %}
|
{% if partials['has_template_statistics'] %}
|
||||||
{{ ajax_block(partials, updates_url, 'template-statistics') }}
|
{{ ajax_block(partials, updates_url, 'template-statistics') }}
|
||||||
{{ show_more(
|
{{ show_more(
|
||||||
url_for('.template_history', service_id=current_service.id),
|
url_for('.template_usage', service_id=current_service.id),
|
||||||
'See templates used by month'
|
'See templates used by month'
|
||||||
) }}
|
) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user