Fix parent stations for Transilien
This commit is contained in:
parent
16520c3664
commit
6ef1df2757
|
@ -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',
|
||||||
|
|
Loading…
Reference in New Issue