Skip to content

Commit

Permalink
front: fix train selection in the anterior or posterior train list
Browse files Browse the repository at this point in the history
Signed-off-by: theocrsb <[email protected]>
  • Loading branch information
theocrsb committed Jan 3, 2025
1 parent 2d1a142 commit adfa631
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion front/src/applications/stdcm/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export type StdcmLinkedTrainExtremity = {
ch: string;
date: string;
geographic: GeoJsonPoint;
isoArrivalTime: string;
isoArrivalTime: Date;
name: string;
obj_id: string;
time: string;
Expand Down
4 changes: 2 additions & 2 deletions front/src/applications/stdcm/utils/computeOpSchedules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ const computeOpSchedules = (startTime: Date, msFromStartTime: number) => {
origin: {
date: originDate,
time: originTime,
isoArrivalTime: subtractDurationFromDate(startTime, 1800).toISOString(),
isoArrivalTime: new Date(subtractDurationFromDate(startTime, 1800)),
},
destination: {
date: destinationDate,
time: destinationTime,
isoArrivalTime: addDurationToDate(destinationArrivalTime, 1800).toISOString(),
isoArrivalTime: new Date(addDurationToDate(destinationArrivalTime, 1800)),
},
};
};
Expand Down
5 changes: 3 additions & 2 deletions front/src/reducers/osrdconf/stdcmConf/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,15 @@ export const stdcmConfSlice = createSlice({
}>
) {
const { linkedTrainExtremity, trainName, pathStep, pathStepId } = action.payload;
const { name, ch, uic, geographic, isoArrivalTime, date, time } = pathStep;
const { name, ch, uic, geographic, isoArrivalTime: arrivalDate, date, time } = pathStep;

const newPathStep = {
name,
ch,
id: pathStepId,
uic,
coordinates: geographic.coordinates,
arrival: isoArrivalTime,
arrival: arrivalDate,
...(linkedTrainExtremity === 'origin' && { arrivalType: ArrivalTimeTypes.PRECISE_TIME }),
};

Expand Down

0 comments on commit adfa631

Please sign in to comment.