Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions front/src/modules/timesStops/hooks/useTimesStopsTableData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,21 +222,31 @@ const useTimesStopsTableData = (

const pathStepRowsById = new Map(
selectedTrain.path.map((pathStep, stepIndex) => {
const matchingOp = pathStepOps.get(pathStep.id)?.at(0);

const name = getOperationalPointName(
matchingOp,
pathStep.location,
stepIndex,
selectedTrain.path.length,
t
);
const pathStepOp = pathStepOps.get(pathStep.id)?.at(0);

const matchingOp =
pathStepOp ??
('operational_point' in pathStep.location && stableOPs
? stableOPs.find((op) => matchPathStepAndOp(pathStep.location, buildOpMatchParams(op)))
: undefined);

const name =
matchingOp?.extensions?.identifier?.name ??
getOperationalPointName(
pathStepOp,
pathStep.location,
stepIndex,
selectedTrain.path.length,
t
);

const pathStepLocation = pathStep.location;

// pathStepOp?.parts is only valid for RelatedOperationalPoint (track-offset steps);
// the stableOPs fallback never applies for those since it requires 'operational_point' in location.
const trackName =
'track' in pathStepLocation
? matchingOp?.parts.find((part) => part.track === pathStepLocation.track)
? pathStepOp?.parts.find((part) => part.track === pathStepLocation.track)
?.local_track_name
: (pathStepLocation.local_track_name ?? undefined);

Expand Down
Loading