@@ -38,7 +38,10 @@ import type {
38
38
} from 'modules/simulationResult/types' ;
39
39
import type { TimetableItemWithDetails } from 'modules/trainschedule/components/Timetable/types' ;
40
40
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' ;
42
45
import type { TimetableItemId , TrainId } from 'reducers/osrdconf/types' ;
43
46
import { updateSelectedTrainId } from 'reducers/simulationResults' ;
44
47
import { useAppDispatch } from 'store' ;
@@ -117,16 +120,25 @@ const ManchetteWithSpaceTimeChartWrapper = ({
117
120
if ( isTrainScheduleProjection ( train ) ) {
118
121
return train ;
119
122
}
123
+ // TODO exceptions : handle added exceptions in issue https://github.com/OpenRailAssociation/osrd/issues/11476
120
124
const pacedTrainId = extractPacedTrainIdFromOccurrenceId ( train . id ) ;
121
125
const occurrencesCount = getOccurrencesNb ( train . paced ) ;
122
126
const occurrences = [ ] ;
123
127
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
+
124
136
const occurrenceStartTime = dayjs ( train . departureTime )
125
137
. add ( i * train . paced . interval . ms , 'ms' )
126
138
. toDate ( ) ;
127
139
occurrences . push ( {
128
140
...train ,
129
- id : formatPacedTrainIdToIndexedOccurrenceId ( pacedTrainId , i ) ,
141
+ id : occurrenceId ,
130
142
name : computeOccurrenceName ( train . name , i ) ,
131
143
departureTime : occurrenceStartTime ,
132
144
} ) ;
0 commit comments