Fix StopTime ID

This commit is contained in:
Emmy D'Anello 2024-05-12 12:14:48 +02:00
parent b85a1b7734
commit 7d9b7d90cd
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
2 changed files with 3 additions and 4 deletions

View File

@ -19,7 +19,7 @@ class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('--debug', '-d', action='store_true', help="Activate debug mode")
parser.add_argument('--bulk_size', '-b', type=int, default=10000, help="Number of objects to create in bulk.")
parser.add_argument('--bulk_size', '-b', type=int, default=2000, help="Number of objects to create in bulk.")
parser.add_argument('--dry-run', action='store_true',
help="Do not update the database, only print what would be done.")
parser.add_argument('--force', '-f', action='store_true', help="Force the update of the database.")
@ -343,8 +343,7 @@ class Command(BaseCommand):
# pickup_type = PickupType.NONE
st = StopTime(
id=f"{gtfs_code}-{stop_time_dict['trip_id']}-{stop_time_dict['stop_id']}"
f"-{stop_time_dict['departure_time']}",
id=f"{gtfs_code}-{stop_time_dict['trip_id']}-{stop_time_dict['stop_sequence']}",
trip_id=trip_id,
arrival_time=timedelta(seconds=arr_time),
departure_time=timedelta(seconds=dep_time),

View File

@ -191,7 +191,7 @@ class Command(BaseCommand):
and stop_sequence < len(trip_update.stop_time_update) - 1 else PickupType.NONE
StopTime.objects.update_or_create(
id=f"{trip_id}-{stop_time_update.stop_id}",
id=f"{gtfs_code}-{trip_id}-{stop_time_update.stop_sequence}",
trip_id=trip_id,
defaults={
"stop_id": stop_id,