Skip to content

Commit

Permalink
Do not upload stop times with orig_dep_date more than 2 days into the…
Browse files Browse the repository at this point in the history
… future (#167)
  • Loading branch information
gsarrco committed Jan 17, 2024
2 parents b24615e + ae98a5b commit 47a5706
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/base/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ def get_source_stations(self) -> list[list[Station, str]]:
return list(results.values())

def upload_trip_stop_time_to_postgres(self, stop_time: TripStopTime):
if stop_time.orig_dep_date > date.today() + timedelta(days=2):
return

stop_id = self.name + '_' + stop_time.station.id if self.name != 'treni' else stop_time.station.id

stmt = insert(StopTime).values(stop_id=stop_id, sched_arr_dt=stop_time.arr_time,
Expand Down

0 comments on commit 47a5706

Please sign in to comment.