Skip to content

Commit 08d8e22

Browse files
committed
front: remove id from step type, clean arrival and departure consts, modify stopfor as number or undefined
1 parent d6f032b commit 08d8e22

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

front/src/applications/operationalStudies/types.ts

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import type { SuggestedOP } from 'modules/trainschedule/components/ManageTrainSc
1818
import type { ArrayElement } from 'utils/types';
1919

2020
export interface Step {
21-
id: string;
2221
uic: number;
2322
chCode?: string;
2423
yard?: string;

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

+2-5
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,7 @@ const ImportTrainScheduleConfig = ({
175175
const times = ocpTT.getElementsByTagName('times')[0];
176176
let departureTime = times?.getAttribute('departure') || '';
177177
let arrivalTime = times?.getAttribute('arrival') || '';
178-
179-
arrivalTime = times?.getAttribute('arrival') || times?.getAttribute('departure') || '';
180178
arrivalTime = cleanTimeFormat(arrivalTime);
181-
departureTime = times?.getAttribute('departure') || times?.getAttribute('arrival') || '';
182179
departureTime = cleanTimeFormat(departureTime);
183180

184181
if (!ocpRef) {
@@ -197,7 +194,7 @@ const ImportTrainScheduleConfig = ({
197194
const formattedArrivalTime = `${startDate} ${arrivalTime}`;
198195
const formattedDepartureTime = `${startDate} ${departureTime}`;
199196

200-
let stopFor = 0;
197+
let stopFor: number | undefined;
201198
if (arrivalTime && departureTime) {
202199
const arrivalDate = new Date(`${startDate}T${arrivalTime}`);
203200
const departureDate = new Date(`${startDate}T${departureTime}`);
@@ -211,7 +208,7 @@ const ImportTrainScheduleConfig = ({
211208
name: ocpRef,
212209
arrivalTime: formattedArrivalTime,
213210
departureTime: formattedDepartureTime,
214-
duration: stopFor > 0 ? stopFor : undefined,
211+
duration: stopFor || undefined,
215212
} as Step;
216213
})
217214
.filter((step): step is Step => step !== null);

0 commit comments

Comments
 (0)