Fix StopTime ID
This commit is contained in:
		@@ -19,7 +19,7 @@ class Command(BaseCommand):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def add_arguments(self, parser):
 | 
					    def add_arguments(self, parser):
 | 
				
			||||||
        parser.add_argument('--debug', '-d', action='store_true', help="Activate debug mode")
 | 
					        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',
 | 
					        parser.add_argument('--dry-run', action='store_true',
 | 
				
			||||||
                            help="Do not update the database, only print what would be done.")
 | 
					                            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.")
 | 
					        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
 | 
					            #     pickup_type = PickupType.NONE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            st = StopTime(
 | 
					            st = StopTime(
 | 
				
			||||||
                id=f"{gtfs_code}-{stop_time_dict['trip_id']}-{stop_time_dict['stop_id']}"
 | 
					                id=f"{gtfs_code}-{stop_time_dict['trip_id']}-{stop_time_dict['stop_sequence']}",
 | 
				
			||||||
                   f"-{stop_time_dict['departure_time']}",
 | 
					 | 
				
			||||||
                trip_id=trip_id,
 | 
					                trip_id=trip_id,
 | 
				
			||||||
                arrival_time=timedelta(seconds=arr_time),
 | 
					                arrival_time=timedelta(seconds=arr_time),
 | 
				
			||||||
                departure_time=timedelta(seconds=dep_time),
 | 
					                departure_time=timedelta(seconds=dep_time),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -191,7 +191,7 @@ class Command(BaseCommand):
 | 
				
			|||||||
                and stop_sequence < len(trip_update.stop_time_update) - 1 else PickupType.NONE
 | 
					                and stop_sequence < len(trip_update.stop_time_update) - 1 else PickupType.NONE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            StopTime.objects.update_or_create(
 | 
					            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,
 | 
					                trip_id=trip_id,
 | 
				
			||||||
                defaults={
 | 
					                defaults={
 | 
				
			||||||
                    "stop_id": stop_id,
 | 
					                    "stop_id": stop_id,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user