From ae98a5b004dfb84e87bc3a381fe78913fc3cc911 Mon Sep 17 00:00:00 2001 From: Giacomo Sarrocco Date: Wed, 17 Jan 2024 22:11:08 +0100 Subject: [PATCH] Do not upload stop times with orig_dep_date more than 2 days into the future --- server/base/source.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/base/source.py b/server/base/source.py index 3c4a02d..68e5d37 100644 --- a/server/base/source.py +++ b/server/base/source.py @@ -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,