mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-05 16:18:26 -04:00
fix so we only show up to current month
This commit is contained in:
@@ -195,6 +195,22 @@ def template_usage(service_id):
|
|||||||
for month in get_months_for_financial_year(year, time_format="%B")
|
for month in get_months_for_financial_year(year, time_format="%B")
|
||||||
]
|
]
|
||||||
months.reverse()
|
months.reverse()
|
||||||
|
|
||||||
|
# Get the year from stats
|
||||||
|
# If the year is this year, remove months in the future
|
||||||
|
if len(stats) > 0:
|
||||||
|
stat_year = stats[0]["year"]
|
||||||
|
current_year = datetime.now().year
|
||||||
|
current_month_num = datetime.now().month
|
||||||
|
new_months = []
|
||||||
|
if stat_year == current_year:
|
||||||
|
for m in months:
|
||||||
|
|
||||||
|
month_num_full = datetime.strptime(m["name"], "%B").month
|
||||||
|
if month_num_full <= current_month_num:
|
||||||
|
new_months.append(m)
|
||||||
|
months = new_months
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"views/dashboard/all-template-statistics.html",
|
"views/dashboard/all-template-statistics.html",
|
||||||
months=months,
|
months=months,
|
||||||
|
|||||||
Reference in New Issue
Block a user