Skip to content

Commit

Permalink
Remove upper bound constraint for orig_dep_date
Browse files Browse the repository at this point in the history
  • Loading branch information
gsarrco committed Dec 16, 2023
1 parent 8876547 commit 03f262f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions server/base/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,13 @@ def get_stop_times(self, stops_ids, line, start_dt: datetime, offset: int | tupl
else:
stmt = select(StopTime)

day = start_dt.date()
day_minus_one = day - timedelta(days=1)
start_day_minus_one = start_dt.date() - timedelta(days=1)
stmt = stmt.filter(StopTime.orig_dep_date >= start_day_minus_one)

if end_dt:
stmt = stmt.filter(StopTime.orig_dep_date <= end_dt.date())

stmt = stmt.filter(StopTime.orig_dep_date.between(day_minus_one, day), StopTime.stop_id.in_(stops_ids))
stmt = stmt.filter(StopTime.stop_id.in_(stops_ids))

if direction == 1:
stmt = stmt.filter(StopTime.sched_dep_dt >= start_dt)
Expand Down

0 comments on commit 03f262f

Please sign in to comment.