Fix parent stations for Transilien

This commit is contained in:
Emmy D'Anello 2024-02-10 18:28:48 +01:00
parent 16520c3664
commit 6ef1df2757
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 2 additions and 11 deletions

View File

@ -104,8 +104,7 @@ class Command(BaseCommand):
zone_id=stop_dict.get('zone_id', ""), zone_id=stop_dict.get('zone_id', ""),
url=stop_dict.get('stop_url', ""), url=stop_dict.get('stop_url', ""),
location_type=stop_dict.get('location_type', 1) or 1, location_type=stop_dict.get('location_type', 1) or 1,
parent_station_id=stop_dict.get('parent_station', None) or None parent_station_id=stop_dict.get('parent_station', None) or None,
if last_update_date != "1970-01-01" or transport_type != "TN" else None,
timezone=stop_dict.get('stop_timezone', ""), timezone=stop_dict.get('stop_timezone', ""),
wheelchair_boarding=stop_dict.get('wheelchair_boarding', 0), wheelchair_boarding=stop_dict.get('wheelchair_boarding', 0),
level_id=stop_dict.get('level_id', ""), level_id=stop_dict.get('level_id', ""),
@ -114,17 +113,9 @@ class Command(BaseCommand):
) )
stops.append(stop) stops.append(stop)
if len(stops) >= bulk_size and not dry_run:
Stop.objects.bulk_create(stops,
update_conflicts=True,
update_fields=['name', 'desc', 'lat', 'lon', 'zone_id', 'url',
'location_type', 'parent_station_id', 'timezone',
'wheelchair_boarding', 'level_id', 'platform_code',
'transport_type'],
unique_fields=['id'])
stops.clear()
if stops and not dry_run: if stops and not dry_run:
Stop.objects.bulk_create(stops, Stop.objects.bulk_create(stops,
batch_size=bulk_size,
update_conflicts=True, update_conflicts=True,
update_fields=['name', 'desc', 'lat', 'lon', 'zone_id', 'url', update_fields=['name', 'desc', 'lat', 'lon', 'zone_id', 'url',
'location_type', 'parent_station_id', 'timezone', 'location_type', 'parent_station_id', 'timezone',