From 85ebaf7c841806bf7562460e2e0552c8a26635d1 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sat, 18 May 2024 14:23:00 +0200 Subject: [PATCH] Show indivudal train legs --- agenda/types.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/agenda/types.py b/agenda/types.py index 0bd4e36..50a2612 100644 --- a/agenda/types.py +++ b/agenda/types.py @@ -224,15 +224,16 @@ class Trip: ) ) if item["type"] == "train": - name = f"{item['from']} -> {item['to']}" - elements.append( - TripElement( - when=item["depart"], - title=name, - detail=item, - element_type="train", + for leg in item["legs"]: + name = f"{leg['from']} → {leg['to']}" + elements.append( + TripElement( + when=leg["depart"], + title=name, + detail=leg, + element_type="train", + ) ) - ) if item["type"] == "ferry": name = f"{item['from']} → {item['to']}" elements.append(