Skip to content

Commit f2bc131

Browse files
committed
front: fix stop_for negative value
Signed-off-by: Louis Greiner <[email protected]>
1 parent e710fdd commit f2bc131

File tree

1 file changed

+3
-1
lines changed
  • front/src/applications/operationalStudies/components/MacroEditor

1 file changed

+3
-1
lines changed

front/src/applications/operationalStudies/components/MacroEditor/ngeToOsrd.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ const createTrainSchedulePayload = async ({
227227
);
228228
const isNonStopTransit = transition?.isNonStopTransit ?? false;
229229

230+
// Note that arrival is the time the train arrives at the node
231+
// and departure is the time the train leaves the node
230232
let arrival = getTimeLockDate(section.targetArrival, startTimeLock, startDate);
231233
const departure = nextSection
232234
? getTimeLockDate(nextSection.sourceDeparture, startTimeLock, startDate)
@@ -242,7 +244,7 @@ const createTrainSchedulePayload = async ({
242244
at: `${section.targetNodeId}-${index + 1}`,
243245
arrival: formatDateDifferenceFrom(startDate, arrival),
244246
stop_for:
245-
departure && !isNonStopTransit ? formatDateDifferenceFrom(departure, arrival) : null,
247+
departure && !isNonStopTransit ? formatDateDifferenceFrom(arrival, departure) : null,
246248
};
247249
});
248250

0 commit comments

Comments
 (0)