Skip to content

Commit

Permalink
Fixed Sqlalchemy warning regarding cartesian product (#2489)
Browse files Browse the repository at this point in the history
Removes the 30 60 90 report's SAWarning by properly declaring the join
between the event and work
  • Loading branch information
Ckoelewyn authored Dec 20, 2024
1 parent 6180b7e commit 4c09fcc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion epictrack-api/src/api/reports/thirty_sixty_ninety_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
),
Expand Down

0 comments on commit 4c09fcc

Please sign in to comment.