Fix PIS file formatting

This commit is contained in:
Fred Boniface 2024-11-12 11:53:44 +00:00
parent b0cba1cd57
commit c2596fd09d

View File

@ -5,7 +5,8 @@ def create_new_pis_file(input):
file_content = "# File produced by DGP2\n\nFor Review before merging\nXXXX\n\n"
for train in input:
file_content += f"""\n
- code: {train.get('diagram_pis_code', 'N/A')}
pis:
- code: {train.get('diagram_pis_code', 'N/A')}
# diagramDate: {train.get('diagram_date', 'N/A')}
# diagramHeadcode: {train.get('train_headcode', 'N/A')}
# diagram_time1: {train.get('diagram_time1', 'N/A')}
@ -13,7 +14,7 @@ def create_new_pis_file(input):
"""
for entry in train.get('timetable_entries', []):
file_content += f"""
stops: {",".join(stop.lower() for stop in entry.get('stops', []))}
stops: [{",".join(stop.lower() for stop in entry.get('stops', []))}]
# stpIndicator: {entry.get('stpIndicator', 'N/A')}
# trainUid: {entry.get('trainUid', 'N/A')}
# scheduleStart: {entry.get('scheduleStart', 'N/A')}