From 4c09fccae2c18099cb1838d99fc686ec8305a46d Mon Sep 17 00:00:00 2001 From: Corey Koelewyn <34955494+Ckoelewyn@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:40:46 -0800 Subject: [PATCH] Fixed Sqlalchemy warning regarding cartesian product (#2489) Removes the 30 60 90 report's SAWarning by properly declaring the join between the event and work --- epictrack-api/src/api/reports/thirty_sixty_ninety_report.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/epictrack-api/src/api/reports/thirty_sixty_ninety_report.py b/epictrack-api/src/api/reports/thirty_sixty_ninety_report.py index 21f221eb..b2984bdb 100644 --- a/epictrack-api/src/api/reports/thirty_sixty_ninety_report.py +++ b/epictrack-api/src/api/reports/thirty_sixty_ninety_report.py @@ -363,7 +363,9 @@ def _get_next_pcp_query(self, start_date, end_date): def _get_valid_event_ids(self, start_date, end_date): """Find and return set of valid decision or high priority event ids""" - valid_events = db.session.query(Event).filter( + valid_events = db.session.query(Event).join( + Work, Work.id == Event.work_id + ).filter( func.coalesce(Event.actual_date, Event.anticipated_date).between( start_date.date(), end_date.date() ),