diff --git a/front/src/applications/operationalStudies/components/MacroEditor/ngeToOsrd.ts b/front/src/applications/operationalStudies/components/MacroEditor/ngeToOsrd.ts index 5c431a9d04d..e09ffd1d9d4 100644 --- a/front/src/applications/operationalStudies/components/MacroEditor/ngeToOsrd.ts +++ b/front/src/applications/operationalStudies/components/MacroEditor/ngeToOsrd.ts @@ -55,7 +55,6 @@ const getTrainrunSectionsByTrainrunId = (netzgrafikDto: NetzgrafikDto, trainrunI // source port. let departureSection: TrainrunSectionDto | undefined; const sectionsByPrevTargetPortId = new Map(); - // eslint-disable-next-line no-restricted-syntax for (const section of sections) { const sourceNode = getNodeById(netzgrafikDto.nodes, section.sourceNodeId)!; const transition = sourceNode.transitions.find( @@ -177,7 +176,6 @@ const createTrainSchedulePayload = async ({ oldStartDate: Date; trainSchedule?: TrainScheduleBase; }) => { - // TODO: check that the trainrunSections format is still compatible const pathPromise = trainrunSections.map(async (section, index) => { const sourceNode = getNodeById(nodes, section.sourceNodeId); const targetNode = getNodeById(nodes, section.targetNodeId); @@ -221,7 +219,12 @@ const createTrainSchedulePayload = async ({ const schedule = trainrunSections.flatMap((section, index) => { const nextSection = trainrunSections[index + 1]; - // TODO: extract isNonStopTransit from transitions + const node = getNodeById(nodes, section.targetNodeId)!; + const transition = node.transitions.find( + (tr) => tr.port1Id === section.targetPortId || tr.port2Id === section.targetPortId + ); + const isNonStopTransit = transition?.isNonStopTransit ?? false; + let arrival = getTimeLockDate(section.targetArrival, startTimeLock, startDate); const departure = nextSection ? getTimeLockDate(nextSection.sourceDeparture, startTimeLock, startDate) @@ -236,7 +239,7 @@ const createTrainSchedulePayload = async ({ return { at: `${section.targetNodeId}-${index + 1}`, arrival: formatDateDifference(arrival, startDate), - stop_for: departure ? formatDateDifference(departure, arrival) : null, + stop_for: departure && !isNonStopTransit ? formatDateDifference(departure, arrival) : null, }; });