Skip to content

Commit 8b332f6

Browse files
committed
front: clean file and remove incorrect conditions
1 parent 1af6295 commit 8b332f6

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

front/src/modules/trainschedule/components/ImportTrainSchedule/ImportTrainScheduleConfig.tsx

+2-11
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,7 @@ const ImportTrainScheduleConfig = ({
176176
const isLastOcp = ocpTT === ocpTTs.at(-1);
177177
const ocpType = ocpTT.getAttribute('ocpType');
178178
let departureTime = times?.getAttribute('departure') || '';
179-
let arrivalTime =
180-
ocpType === 'pass'
181-
? times?.getAttribute('departure') || ''
182-
: times?.getAttribute('arrival') || '';
179+
let arrivalTime = ocpType === 'pass' ? departureTime : times?.getAttribute('arrival') || '';
183180
arrivalTime = cleanTimeFormat(arrivalTime);
184181
departureTime = cleanTimeFormat(departureTime);
185182

@@ -210,14 +207,8 @@ const ImportTrainScheduleConfig = ({
210207
stopFor = 0;
211208
}
212209
} else if (ocpType === 'pass') {
213-
if (arrivalTime && departureTime && arrivalTime !== departureTime) {
214-
// Incorrect data, it shouldn't happen on a ocpType pass, skip step
215-
return null;
216-
}
217210
if (isLastOcp) {
218211
stopFor = 0;
219-
} else {
220-
stopFor = undefined;
221212
}
222213
}
223214

@@ -228,7 +219,7 @@ const ImportTrainScheduleConfig = ({
228219
name: ocpRef,
229220
arrivalTime: formattedArrivalTime,
230221
departureTime: formattedDepartureTime,
231-
duration: stopFor || undefined,
222+
duration: stopFor,
232223
} as Step;
233224
})
234225
.filter((step): step is Step => step !== null);

0 commit comments

Comments
 (0)