From e8d87733513537d2e95033108640f13d9e180f3d Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Thu, 9 Oct 2025 07:31:15 -0700 Subject: [PATCH] fix so we only show up to current month --- app/main/views/dashboard.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index 8683b5a62..d84727569 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -195,6 +195,22 @@ def template_usage(service_id): for month in get_months_for_financial_year(year, time_format="%B") ] 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( "views/dashboard/all-template-statistics.html", months=months,