Drop transfers before populating new ones
This commit is contained in:
parent
0d622302ac
commit
a4a8cd9e9f
|
@ -9,6 +9,7 @@ from zoneinfo import ZoneInfo
|
||||||
import requests
|
import requests
|
||||||
from django.core.management import BaseCommand
|
from django.core.management import BaseCommand
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
from django.db.models import Q
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from trainvel.gtfs.models import Agency, Calendar, CalendarDate, FeedInfo, GTFSFeed, Route, Stop, StopTime, \
|
from trainvel.gtfs.models import Agency, Calendar, CalendarDate, FeedInfo, GTFSFeed, Route, Stop, StopTime, \
|
||||||
|
@ -368,6 +369,7 @@ class Command(BaseCommand):
|
||||||
stop_times.clear()
|
stop_times.clear()
|
||||||
|
|
||||||
if os.path.exists(os.path.join(zip_dir, "transfers.txt")):
|
if os.path.exists(os.path.join(zip_dir, "transfers.txt")):
|
||||||
|
Transfer.objects.filter(Q(from_stop__gtfs_feed_id=gtfs_code) | Q(to_stop__gtfs_feed_id=gtfs_code)).delete()
|
||||||
transfers = []
|
transfers = []
|
||||||
for transfer_dict in read_csv("transfers.txt"):
|
for transfer_dict in read_csv("transfers.txt"):
|
||||||
transfer_dict: dict
|
transfer_dict: dict
|
||||||
|
|
Loading…
Reference in New Issue