Skip to content

Commit e69ecb1

Browse files
committed
front: fix via added by map click not updated
1 parent 1692f8c commit e69ecb1

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

front/src/modules/timesStops/utils.ts

+23-7
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,27 @@ export const formatSuggestedViasToRowVias = (
2525
formattedOps.unshift(operationalPoints[originIndexInOps]);
2626
}
2727
}
28-
return formattedOps.map((op, i) => ({
29-
...op,
30-
name: op.name || t('waypoint', { id: op.opId }),
31-
isMarginValid: op.theoreticalMargin ? marginRegExValidation.test(op.theoreticalMargin) : true,
32-
onStopSignal: op.onStopSignal || false,
33-
arrival: i === 0 ? startTime?.substring(11, 19) : op.arrival,
34-
}));
28+
return formattedOps.map((op, i) => {
29+
const isMarginValid = op.theoreticalMargin
30+
? marginRegExValidation.test(op.theoreticalMargin)
31+
: true;
32+
33+
const correspondingOp = !('uic' in op)
34+
? pathSteps.find((step) => step.id === op.opId)
35+
: undefined;
36+
37+
const { arrival, onStopSignal, name } = correspondingOp || op;
38+
39+
return {
40+
...op,
41+
isMarginValid,
42+
arrival: i === 0 ? startTime?.substring(11, 19) : arrival,
43+
onStopSignal: onStopSignal || false,
44+
name: name || t('waypoint', { id: op.opId }),
45+
...(correspondingOp && {
46+
stopFor: correspondingOp.stopFor,
47+
theoreticalMargin: correspondingOp.theoreticalMargin,
48+
}),
49+
};
50+
});
3551
};

0 commit comments

Comments
 (0)