Skip to content

Commit d7ff4a7

Browse files
committed
front: hide disabled occurrences in std
Signed-off-by: SharglutDev <[email protected]>
1 parent 1d33611 commit d7ff4a7

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

front/src/applications/operationalStudies/helpers/upsertNewProjectedTrains.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const upsertNewProjectedTrains = (
3434
timeWindow: Duration.parse(matchingTrain.paced.time_window),
3535
interval: Duration.parse(matchingTrain.paced.interval),
3636
},
37+
exceptions: matchingTrain.exceptions,
3738
}
3839
: { id: matchingTrain.id }),
3940
};

front/src/modules/simulationResult/components/ManchetteWithSpaceTimeChart/ManchetteWithSpaceTimeChart.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ import type {
3838
} from 'modules/simulationResult/types';
3939
import type { TimetableItemWithDetails } from 'modules/trainschedule/components/Timetable/types';
4040
import computeOccurrenceName from 'modules/trainschedule/helpers/computeOccurrenceName';
41-
import { getOccurrencesNb } from 'modules/trainschedule/helpers/pacedTrain';
41+
import {
42+
findExceptionWithOccurrenceId,
43+
getOccurrencesNb,
44+
} from 'modules/trainschedule/helpers/pacedTrain';
4245
import type { TimetableItemId, TrainId } from 'reducers/osrdconf/types';
4346
import { updateSelectedTrainId } from 'reducers/simulationResults';
4447
import { useAppDispatch } from 'store';
@@ -117,16 +120,25 @@ const ManchetteWithSpaceTimeChartWrapper = ({
117120
if (isTrainScheduleProjection(train)) {
118121
return train;
119122
}
123+
// TODO exceptions : handle added exceptions in issue https://github.com/OpenRailAssociation/osrd/issues/11476
120124
const pacedTrainId = extractPacedTrainIdFromOccurrenceId(train.id);
121125
const occurrencesCount = getOccurrencesNb(train.paced);
122126
const occurrences = [];
123127
for (let i = 0; i < occurrencesCount; i += 1) {
128+
const occurrenceId = formatPacedTrainIdToIndexedOccurrenceId(pacedTrainId, i);
129+
const correspondingException = findExceptionWithOccurrenceId(
130+
train.exceptions,
131+
occurrenceId
132+
);
133+
// Disabled occurrences should not be projected
134+
if (correspondingException?.disabled) continue;
135+
124136
const occurrenceStartTime = dayjs(train.departureTime)
125137
.add(i * train.paced.interval.ms, 'ms')
126138
.toDate();
127139
occurrences.push({
128140
...train,
129-
id: formatPacedTrainIdToIndexedOccurrenceId(pacedTrainId, i),
141+
id: occurrenceId,
130142
name: computeOccurrenceName(train.name, i),
131143
departureTime: occurrenceStartTime,
132144
});

front/src/modules/simulationResult/types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type {
77
SimulationResponseSuccess,
88
} from 'applications/operationalStudies/types';
99
import type {
10+
PacedTrainException,
1011
PathProperties,
1112
PathfindingResultSuccess,
1213
ProjectPathTrainResult,
@@ -43,7 +44,10 @@ export type TrainSpaceTimeData = {
4344
}[];
4445
departureTime: Date;
4546
signalUpdates: ProjectPathTrainResult['signal_updates'];
46-
} & ({ id: TrainScheduleId } | { id: OccurrenceId; paced: PacedTrainWithDetails['paced'] });
47+
} & (
48+
| { id: TrainScheduleId }
49+
| { id: OccurrenceId; paced: PacedTrainWithDetails['paced']; exceptions: PacedTrainException[] }
50+
);
4751

4852
// Speed Space Chart
4953
export type SpeedLimitTagValue = ArrayElement<SimulationResponseSuccess['mrsp']['values']>;

0 commit comments

Comments
 (0)