diff --git a/epictrack-api/src/api/reports/anticipated_schedule_report.py b/epictrack-api/src/api/reports/anticipated_schedule_report.py index 9f154384..43f87bb9 100644 --- a/epictrack-api/src/api/reports/anticipated_schedule_report.py +++ b/epictrack-api/src/api/reports/anticipated_schedule_report.py @@ -73,6 +73,7 @@ def __init__(self, filters, color_intensity): "event_name", "notes", "next_pecp_number_of_days", + "next_pecp_phase_name", "amendment_title", "work_type_id", "work_type" @@ -312,6 +313,7 @@ def _fetch_data(self, report_date): Event.actual_date, ).label("next_pecp_date"), next_pecp_query.c.notes.label("next_pecp_short_description"), + next_pecp_query.c.phase_name.label("next_pecp_phase_name"), func.coalesce(next_pecp_query.c.number_of_days, 0).label("next_pecp_number_of_days"), ) ) @@ -324,6 +326,7 @@ def _fetch_data(self, report_date): # - If successful, extracts and concatenates text from JSON blocks. # - Logs a warning if JSON parsing fails. for result in results_dict: + result['next_pecp_phase_name'] = result.get('next_pecp_phase_name', None) if 'next_pecp_short_description' in result and result['next_pecp_short_description'] is not None: current_app.logger.debug(f"Next PECP Short Description: {result['next_pecp_short_description']}") try: @@ -353,6 +356,7 @@ def generate_report(self, report_date, return_type): item_dict = item._asdict() item_dict['work_issues'] = work_issues item_dict['next_pecp_number_of_days'] = item.next_pecp_number_of_days + item_dict['next_pecp_phase_name'] = item.next_pecp_phase_name item_dict['notes'] = "" # go through all the work issues, find the update and add the description to the issue @@ -554,6 +558,7 @@ def _get_next_pcp_query(self, start_date): db.session.query( Event, Event.number_of_days, + WorkPhase.name.label("phase_name"), ) .join( next_pcp_min_date_query, @@ -562,6 +567,14 @@ def _get_next_pcp_query(self, start_date): func.coalesce(Event.actual_date, Event.anticipated_date) == next_pcp_min_date_query.c.min_pcp_date, ), ) + .join( + EventConfiguration, + EventConfiguration.id == Event.event_configuration_id + ) + .join( + WorkPhase, + EventConfiguration.work_phase_id == WorkPhase.id + ) .filter( Event.event_configuration_id.in_(pecp_configuration_ids), ) diff --git a/epictrack-api/src/api/reports/report_templates/anticipated_schedule.docx b/epictrack-api/src/api/reports/report_templates/anticipated_schedule.docx index f8e17461..74e7796b 100644 Binary files a/epictrack-api/src/api/reports/report_templates/anticipated_schedule.docx and b/epictrack-api/src/api/reports/report_templates/anticipated_schedule.docx differ diff --git a/epictrack-web/src/components/reports/eaReferral/AnticipatedEAOSchedule.tsx b/epictrack-web/src/components/reports/eaReferral/AnticipatedEAOSchedule.tsx index a84a8a33..b25e8d29 100644 --- a/epictrack-web/src/components/reports/eaReferral/AnticipatedEAOSchedule.tsx +++ b/epictrack-web/src/components/reports/eaReferral/AnticipatedEAOSchedule.tsx @@ -81,6 +81,7 @@ export default function AnticipatedEAOSchedule() { if (reportData.status === 200) { const reports = reportData.data as ReportData; setReports(reports.data); + console.info("ReportData:", reports); } if (reportData.status === 204) { @@ -211,6 +212,7 @@ export default function AnticipatedEAOSchedule() { .map((group, _) => { const groupName = group.group; const items = group.items; + console.info("group:", group); return ( <> {items.map((item, itemIndex) => { - console.log(item); + console.log("item:", item); return (