tcl: adapt to updated attributes in line data sources (#71509)

This commit is contained in:
Frédéric Péters 2022-11-21 13:45:57 +01:00
parent 56b6baea78
commit 9b889430d1
2 changed files with 6 additions and 6 deletions

View File

@ -131,6 +131,10 @@ class Tcl(BaseResource):
response = self.requests.get(url) response = self.requests.get(url)
response.raise_for_status() response.raise_for_status()
for line_data in response.json()['values']: for line_data in response.json()['values']:
if 'code_trace' in line_data:
line_data['code_titan'] = line_data['code_trace']
if 'nom_trace' in line_data:
line_data['libelle'] = line_data['nom_trace']
line, dummy = Line.objects.get_or_create( line, dummy = Line.objects.get_or_create(
code_titan=line_data['code_titan'], code_titan=line_data['code_titan'],
defaults={'transport_key': key, 'ligne': line_data['ligne']}, defaults={'transport_key': key, 'ligne': line_data['ligne']},

View File

@ -10,16 +10,12 @@ from passerelle.contrib.tcl.models import Line, Stop, Tcl
LIGNE_BUS = { LIGNE_BUS = {
"values": [ "values": [
{ {
"indice": "",
"last_update_fme": "2017-06-27 06:01:10", "last_update_fme": "2017-06-27 06:01:10",
"infos": "", "nom_trace": "Croix Rousse - Plateaux de St Rambert",
"couleur": "164 203 38",
"libelle": "Croix Rousse - Plateaux de St Rambert",
"last_update": "None", "last_update": "None",
"code_titan": "2Aa1", "code_trace": "2Aa1",
"gid": "1003", "gid": "1003",
"ligne": "2", "ligne": "2",
"ut": "UTV",
"sens": "Aller", "sens": "Aller",
}, },
] ]