Drop old services before updating GTFS data
This commit is contained in:
parent
6ef1df2757
commit
ee5eb13a01
|
@ -56,8 +56,6 @@ class Command(BaseCommand):
|
|||
|
||||
self.stdout.write("Updating database...")
|
||||
|
||||
all_trips = []
|
||||
|
||||
for transport_type, feed_url in self.GTFS_FEEDS.items():
|
||||
self.stdout.write(f"Downloading {transport_type} GTFS feed...")
|
||||
with ZipFile(BytesIO(requests.get(feed_url).content)) as zipfile:
|
||||
|
@ -161,6 +159,7 @@ class Command(BaseCommand):
|
|||
unique_fields=['id'])
|
||||
routes.clear()
|
||||
|
||||
Calendar.objects.filter(transport_type=transport_type).delete()
|
||||
calendar_ids = []
|
||||
if "calendar.txt" in zipfile.namelist():
|
||||
calendars = []
|
||||
|
@ -299,8 +298,6 @@ class Command(BaseCommand):
|
|||
unique_fields=['id'])
|
||||
trips.clear()
|
||||
|
||||
all_trips.extend(trips)
|
||||
|
||||
stop_times = []
|
||||
for stop_time_dict in csv.DictReader(read_file("stop_times.txt")):
|
||||
stop_time_dict: dict
|
||||
|
|
Loading…
Reference in New Issue