Skip to content

Commit 876dccc

Browse files
committed
fixup! front: align margins display and computation to spec in timestops table
1 parent 6690d02 commit 876dccc

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

front/src/modules/timesStops/helpers/computeMargins.ts

+6-9
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,15 @@ export function getTheoreticalMargins(selectedTrainSchedule: TrainScheduleResult
1212
const theoreticalMargins: TheoreticalMarginsRecord = {};
1313
let marginIndex = 0;
1414
selectedTrainSchedule.path.forEach((step, index) => {
15+
let isBoundary = index === 0;
1516
if (step.id === selectedTrainSchedule.margins?.boundaries[marginIndex]) {
1617
marginIndex += 1;
17-
theoreticalMargins[step.id] = {
18-
theoreticalMargin: selectedTrainSchedule.margins?.values[marginIndex],
19-
isBoundary: true,
20-
};
21-
} else {
22-
theoreticalMargins[step.id] = {
23-
theoreticalMargin: selectedTrainSchedule.margins?.values[marginIndex],
24-
isBoundary: index === 0,
25-
};
18+
isBoundary = true;
2619
}
20+
theoreticalMargins[step.id] = {
21+
theoreticalMargin: selectedTrainSchedule.margins?.values[marginIndex],
22+
isBoundary,
23+
};
2724
});
2825
return theoreticalMargins;
2926
}

0 commit comments

Comments
 (0)