From 4a563fd05394a4332388e6c79424ea89ad195238 Mon Sep 17 00:00:00 2001 From: Shaelyn Tolkamp Date: Thu, 12 Dec 2024 15:51:51 -0800 Subject: [PATCH] [Track-303-3] RF handle last phase if it persists into month --- epictrack-api/src/api/reports/resource_forecast_report.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/epictrack-api/src/api/reports/resource_forecast_report.py b/epictrack-api/src/api/reports/resource_forecast_report.py index f5291c0d..6c3ac685 100644 --- a/epictrack-api/src/api/reports/resource_forecast_report.py +++ b/epictrack-api/src/api/reports/resource_forecast_report.py @@ -439,6 +439,10 @@ def _update_month_labels(self, works, start_events): phase_end = event["phase_end"].date() if phase_start <= month_end and phase_end >= month_start: if phase_end.month == month_start.month and 1 <= phase_end.day <= 14: + # If this is the last phase show it as long as it persists at least 5 days into the month + if event == sorted_events[-1] and phase_end.day > 4: + event_to_show = event + break # Show the next phase if the phase ends in the early part of the month next_event = next( (e for e in sorted_events if e["phase_start"].date() > phase_end),