Skip to content

Commit

Permalink
hotfix: update dep_time and arr_time for stop_times if different (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsarrco authored Oct 13, 2023
2 parents 8b698aa + f0b468b commit 2b17d43
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion MuoVErsi/sources/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,11 @@ def upload_trip_stop_time_to_postgres(self, stop_time: TripStopTime):
stop_time_db = self.session.query(StopTime).filter_by(trip_id=train.id, stop_id=stop_id).first()

if stop_time_db:
if stop_time_db.platform != stop_time.platform:
if stop_time_db.platform != stop_time.platform or stop_time_db.sched_arr_dt != stop_time.arr_time or \
stop_time_db.sched_dep_dt != stop_time.dep_time:
stop_time_db.platform = stop_time.platform
stop_time_db.sched_arr_dt = stop_time.arr_time
stop_time_db.sched_dep_dt = stop_time.dep_time
self.session.commit()
else:
new_stop_time = StopTime(trip_id=train.id, stop_id=stop_id, sched_arr_dt=stop_time.arr_time,
Expand Down

0 comments on commit 2b17d43

Please sign in to comment.