@@ -92,15 +92,13 @@ const useSetupItineraryForTrainUpdate = (
92
92
const tracks = await getTrackSectionsByIds ( trackSectionIds ) ;
93
93
94
94
// get operational points
95
- let ops : SearchResultItemOperationalPoint [ ] = [ ] ;
96
95
const searchPayload = buildOpSearchQuery ( infraId , [ trainSchedule ] ) ;
97
-
98
- if ( searchPayload ) {
99
- ops = ( await postSearch ( {
100
- searchPayload,
101
- pageSize : 1000 ,
102
- } ) . unwrap ( ) ) as SearchResultItemOperationalPoint [ ] ;
103
- }
96
+ const ops = searchPayload
97
+ ? ( ( await postSearch ( {
98
+ searchPayload,
99
+ pageSize : 1000 ,
100
+ } ) . unwrap ( ) ) as SearchResultItemOperationalPoint [ ] )
101
+ : [ ] ;
104
102
105
103
// match path steps with track sections or operational points
106
104
const pathStepsWithCoordinates = trainSchedule . path . map ( ( step , index ) => {
@@ -116,15 +114,13 @@ const useSetupItineraryForTrainUpdate = (
116
114
let op : SearchResultItemOperationalPoint | undefined ;
117
115
if ( 'uic' in step ) {
118
116
op = ops . find ( ( o ) => o . uic === step . uic ) ;
119
- name = `${ op ?. name } - ${ step . uic } ` ;
120
117
} else if ( 'trigram' in step ) {
121
118
op = ops . find ( ( o ) => o . trigram === step . trigram ) ;
122
- name = `${ op ?. name } - ${ step . trigram } ` ;
123
119
} else {
124
120
op = ops . find ( ( o ) => o . obj_id === step . operational_point ) ;
125
- name = `${ op ?. name } - ${ step . operational_point } ` ;
126
121
}
127
122
coordinates = op ?. geographic . coordinates ;
123
+ name = `${ op ?. name } ` ;
128
124
}
129
125
130
126
return {
@@ -134,7 +130,6 @@ const useSetupItineraryForTrainUpdate = (
134
130
} ;
135
131
} ) ;
136
132
137
- // update le store
138
133
dispatch ( updatePathSteps ( pathStepsWithCoordinates ) ) ;
139
134
} ;
140
135
0 commit comments