Skip to content

Commit 99ccfeb

Browse files
committed
fixup! front: fix track_name on timetable for imported train
1 parent d4ddba3 commit 99ccfeb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

front/src/modules/timesStops/hooks/useOutputTableData.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ const useOutputTableData = (
3838

3939
const trackIds = useMemo(() => {
4040
const path = selectedTrain?.path || [];
41-
const trackIdsInPathSteps = path.flatMap((step) => ('track' in step ? [step.track] : []));
41+
const trackIdsInPathSteps = path.flatMap((step) => [
42+
...('track' in step ? [step.track] : []),
43+
...('track_reference' in step && step.track_reference && 'track_id' in step.track_reference
44+
? [step.track_reference.track_id]
45+
: []),
46+
]);
4247
const trackIdsOnPath = (operationalPointsOnPath || []).map((op) => op.part.track);
4348
return [...trackIdsInPathSteps, ...trackIdsOnPath];
4449
}, [selectedTrain?.path, operationalPointsOnPath]);
@@ -79,7 +84,7 @@ const useOutputTableData = (
7984
const trackName =
8085
'track' in pathStep
8186
? trackSections[pathStep.track]?.extensions?.sncf?.track_name
82-
: getTrackReferenceLabel(pathStep.track_reference);
87+
: getTrackReferenceLabel(trackSections, pathStep.track_reference);
8388

8489
const schedule = scheduleByAt[pathStep.id];
8590
const computedArrival = simulatedPathItemTimes

0 commit comments

Comments
 (0)