@@ -3,36 +3,20 @@ import { compact } from 'lodash';
3
3
import type { Dispatch } from 'redux' ;
4
4
5
5
import type {
6
- PathItemLocation ,
7
6
PathfindingItem ,
8
7
PostTimetableByIdStdcmApiArg ,
9
8
TrainScheduleBase ,
10
9
} from 'common/api/osrdEditoastApi' ;
10
+ import getStepLocation from 'modules/pathfinding/helpers/getStepLocation' ;
11
11
import type { InfraState } from 'reducers/infra' ;
12
12
import { setFailure } from 'reducers/main' ;
13
- import type { OsrdStdcmConfState , StandardAllowance , StdcmPathStep } from 'reducers/osrdconf/types' ;
13
+ import type { OsrdStdcmConfState , StandardAllowance } from 'reducers/osrdconf/types' ;
14
14
import { dateTimeFormatting } from 'utils/date' ;
15
- import { kmhToMs , mToMm , tToKg } from 'utils/physics' ;
15
+ import { kmhToMs , tToKg } from 'utils/physics' ;
16
16
import { ISO8601Duration2sec , sec2ms } from 'utils/timeManipulation' ;
17
17
18
18
import createMargin from './createMargin' ;
19
19
20
- const getStepLocation = ( step : StdcmPathStep ) : PathItemLocation => {
21
- if ( 'track' in step ) {
22
- return { track : step . track , offset : mToMm ( step . offset ) } ;
23
- }
24
- if ( 'operational_point' in step ) {
25
- return { operational_point : step . operational_point } ;
26
- }
27
- if ( 'trigram' in step ) {
28
- return { trigram : step . trigram , secondary_code : step . secondary_code } ;
29
- }
30
- if ( step . uic === - 1 ) {
31
- throw new Error ( 'Invalid UIC' ) ;
32
- }
33
- return { uic : step . uic , secondary_code : step . secondary_code } ;
34
- } ;
35
-
36
20
// TODO: DROP STDCM V1: remove formattedStartTime, startTime and latestStartTime
37
21
type ValidStdcmConfig = {
38
22
rollingStockId : number ;
0 commit comments