Skip to content

Commit ec5dac5

Browse files
Synarclarani
authored andcommitted
front: fix th margin input in timesstops table
Signed-off-by: Alice Khoudli <[email protected]>
1 parent deac2f4 commit ec5dac5

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

front/src/modules/timesStops/TimesStopsInput.tsx

+14-19
Original file line numberDiff line numberDiff line change
@@ -103,26 +103,21 @@ const TimesStopsInput = ({ allWaypoints, startTime, pathSteps }: TimesStopsInput
103103
if (!updatedRows[operation.fromRowIndex].isMarginValid) {
104104
newRows[operation.fromRowIndex].isMarginValid = false;
105105
setRows(newRows);
106-
} else if (
107-
!rows[operation.fromRowIndex].isMarginValid &&
108-
updatedRows[operation.fromRowIndex].isMarginValid
109-
) {
110-
newRows[operation.fromRowIndex].isMarginValid = true;
111-
setRows(newRows);
112-
} else {
113-
const newVias = updatedRows
114-
.filter(
115-
(row, index) =>
116-
!isEqual(normalizeNullablesInRow(row), normalizeNullablesInRow(rows[index]))
117-
)
118-
.map(({ shortSlipDistance, onStopSignal, arrival, departure, ...row }) => ({
119-
...row,
120-
arrival: durationSinceStartTime(startTime, arrival),
121-
departure: durationSinceStartTime(startTime, departure),
122-
receptionSignal: onStopSignalToReceptionSignal(onStopSignal, shortSlipDistance),
123-
}));
124-
dispatch(upsertSeveralViasFromSuggestedOP(newVias));
106+
return;
125107
}
108+
109+
const newVias = updatedRows
110+
.filter(
111+
(row, index) =>
112+
!isEqual(normalizeNullablesInRow(row), normalizeNullablesInRow(rows[index]))
113+
)
114+
.map(({ shortSlipDistance, onStopSignal, arrival, departure, ...row }) => ({
115+
...row,
116+
arrival: durationSinceStartTime(startTime, arrival),
117+
departure: durationSinceStartTime(startTime, departure),
118+
receptionSignal: onStopSignalToReceptionSignal(onStopSignal, shortSlipDistance),
119+
}));
120+
dispatch(upsertSeveralViasFromSuggestedOP(newVias));
126121
},
127122
[rows, startTime]
128123
);

0 commit comments

Comments
 (0)