@@ -305,7 +307,12 @@ const SimulationReportSheet = ({
const prevStep = operationalPointsList[index - 1];
const isViaInSimulationPath = stdcmData.simulationPathSteps
.slice(1, -1)
- .some((pathStep) => pathStep.name === step.name && pathStep.ch === step.ch);
+ .some(
+ (pathStep) =>
+ pathStep.name === step.name &&
+ 'secondary_code' in pathStep &&
+ pathStep.secondary_code === step.ch
+ );
const isViaWithoutStop = isViaInSimulationPath && step.duration === 0;
const isNotExtremity = !isFirstStep && !isLastStep;
const isStepWithDuration = step.duration !== 0 && !isLastStep;
diff --git a/front/src/applications/stdcm/components/StdcmResults/StdcmResultsTable.tsx b/front/src/applications/stdcm/components/StdcmResults/StdcmResultsTable.tsx
index 61509086f78..5670aa812a8 100644
--- a/front/src/applications/stdcm/components/StdcmResults/StdcmResultsTable.tsx
+++ b/front/src/applications/stdcm/components/StdcmResults/StdcmResultsTable.tsx
@@ -52,7 +52,10 @@ const StcdmResultsTable = ({
const isLastStep = index === operationalPointsList.length - 1;
const prevStep = operationalPointsList[index - 1];
const isRequestedPathStep = stdcmData.simulationPathSteps.some(
- (pathStep) => pathStep.name === step.name && pathStep.ch === step.ch
+ (pathStep) =>
+ pathStep.name === step.name &&
+ 'secondary_code' in pathStep &&
+ pathStep.secondary_code === step.ch
);
const shouldRenderRow = isFirstStep || isRequestedPathStep || isLastStep;
const isPathStep =
diff --git a/front/src/modules/pathfinding/components/Itinerary/DisplayItinerary/Vias.tsx b/front/src/modules/pathfinding/components/Itinerary/DisplayItinerary/Vias.tsx
index 0b013a5dda1..062994fb3dc 100644
--- a/front/src/modules/pathfinding/components/Itinerary/DisplayItinerary/Vias.tsx
+++ b/front/src/modules/pathfinding/components/Itinerary/DisplayItinerary/Vias.tsx
@@ -67,7 +67,9 @@ const Vias = ({ zoomToFeaturePoint, shouldManageStopDuration }: ViasProps) => {
{`${via.name || (via.positionOnPath && `KM ${(Math.round(via.positionOnPath) / 1000000).toFixed(3)}`) || t('unavailableDistance')}`}
- {via.ch && {via.ch}}
+ {'secondary_code' in via && via.secondary_code && (
+ {via.secondary_code}
+ )}
{'uic' in via && (
{formatUicToCi(via.uic)}
diff --git a/front/src/modules/pathfinding/components/Pathfinding/TypeAndPath.tsx b/front/src/modules/pathfinding/components/Pathfinding/TypeAndPath.tsx
index 39fb7a78d25..23d167ec608 100644
--- a/front/src/modules/pathfinding/components/Pathfinding/TypeAndPath.tsx
+++ b/front/src/modules/pathfinding/components/Pathfinding/TypeAndPath.tsx
@@ -167,7 +167,6 @@ const TypeAndPath = ({ setDisplayTypeAndPath }: TypeAndPathProps) => {
.filter((op) => op.trigram !== '')
.map(({ uic, ch }) => ({
uic,
- ch,
secondary_code: ch,
id: nextId(),
}));
diff --git a/front/src/modules/pathfinding/helpers/getStepLocation.ts b/front/src/modules/pathfinding/helpers/getStepLocation.ts
index 0bae3255ebf..8a653717ba8 100644
--- a/front/src/modules/pathfinding/helpers/getStepLocation.ts
+++ b/front/src/modules/pathfinding/helpers/getStepLocation.ts
@@ -12,12 +12,12 @@ const getStepLocation = (step: PathStep | StdcmPathStep): PathItemLocation => {
return { operational_point: step.operational_point };
}
if ('trigram' in step) {
- return { trigram: step.trigram, secondary_code: step.ch };
+ return { trigram: step.trigram, secondary_code: step.secondary_code };
}
if (step.uic === -1) {
throw new Error('Invalid UIC');
}
- return { uic: step.uic, secondary_code: step.ch };
+ return { uic: step.uic, secondary_code: step.secondary_code };
};
export default getStepLocation;
diff --git a/front/src/modules/pathfinding/hooks/usePathfinding.ts b/front/src/modules/pathfinding/hooks/usePathfinding.ts
index 27036c2331e..5f1b7200859 100644
--- a/front/src/modules/pathfinding/hooks/usePathfinding.ts
+++ b/front/src/modules/pathfinding/hooks/usePathfinding.ts
@@ -297,7 +297,7 @@ export const usePathfinding = (
...(correspondingOp && {
name: correspondingOp.name,
uic: correspondingOp.uic,
- ch: correspondingOp.ch,
+ secondary_code: correspondingOp.ch,
kp: correspondingOp.kp,
coordinates: correspondingOp.coordinates,
}),
diff --git a/front/src/modules/pathfinding/utils.ts b/front/src/modules/pathfinding/utils.ts
index f484efc7889..db91fbed8e9 100644
--- a/front/src/modules/pathfinding/utils.ts
+++ b/front/src/modules/pathfinding/utils.ts
@@ -44,10 +44,10 @@ export const matchPathStepAndOp = (
return step.operational_point === op.opId;
}
if ('uic' in step) {
- return step.uic === op.uic && step.ch === op.ch;
+ return step.uic === op.uic && step.secondary_code === op.ch;
}
if ('trigram' in step) {
- return step.trigram === op.trigram && step.ch === op.ch;
+ return step.trigram === op.trigram && step.secondary_code === op.ch;
}
return step.track === op.track && step.offset === op.offsetOnTrack;
};
diff --git a/front/src/modules/trainschedule/components/ManageTrainSchedule/helpers/__tests__/formatSchedule.spec.ts b/front/src/modules/trainschedule/components/ManageTrainSchedule/helpers/__tests__/formatSchedule.spec.ts
index de40cc5c0ce..404af3191de 100644
--- a/front/src/modules/trainschedule/components/ManageTrainSchedule/helpers/__tests__/formatSchedule.spec.ts
+++ b/front/src/modules/trainschedule/components/ManageTrainSchedule/helpers/__tests__/formatSchedule.spec.ts
@@ -12,7 +12,7 @@ describe('formatSchedule', () => {
id: 'id331',
deleted: false,
uic: 8706,
- ch: 'BV',
+ secondary_code: 'BV',
kp: '130+538',
name: 'G',
positionOnPath: 0,
@@ -27,7 +27,7 @@ describe('formatSchedule', () => {
id: 'id332',
deleted: false,
uic: 8737,
- ch: 'BV',
+ secondary_code: 'BV',
kp: '117+422',
name: 'V',
positionOnPath: 13116000,
diff --git a/front/src/modules/trainschedule/helpers/computeBasePathSteps.ts b/front/src/modules/trainschedule/helpers/computeBasePathSteps.ts
index b50e452854a..03eaa539817 100644
--- a/front/src/modules/trainschedule/helpers/computeBasePathSteps.ts
+++ b/front/src/modules/trainschedule/helpers/computeBasePathSteps.ts
@@ -1,5 +1,3 @@
-import { omit } from 'lodash';
-
import type { TrainScheduleResult } from 'common/api/osrdEditoastApi';
import type { PathStep } from 'reducers/osrdconf/types';
import { mmToM } from 'utils/physics';
@@ -34,12 +32,6 @@ const computeBasePathSteps = (
reception_signal: receptionSignal,
} = correspondingSchedule || {};
- const stepWithoutSecondaryCode = omit(step, ['secondary_code']);
-
- if ('track' in stepWithoutSecondaryCode) {
- stepWithoutSecondaryCode.offset = mmToM(stepWithoutSecondaryCode.offset!);
- }
-
let name;
if ('trigram' in step) {
name = step.trigram + (step.secondary_code ? `/${step.secondary_code}` : '');
@@ -55,8 +47,8 @@ const computeBasePathSteps = (
}
return {
- ...stepWithoutSecondaryCode,
- ch: 'secondary_code' in step ? step.secondary_code : undefined,
+ ...step,
+ ...('track' in step && { offset: mmToM(step.offset) }),
name,
arrival, // ISODurationString
stopFor: stopFor ? ISO8601Duration2sec(stopFor).toString() : stopFor,
diff --git a/front/src/reducers/osrdconf/helpers.ts b/front/src/reducers/osrdconf/helpers.ts
index 58dab6aa211..b103ee80b4d 100644
--- a/front/src/reducers/osrdconf/helpers.ts
+++ b/front/src/reducers/osrdconf/helpers.ts
@@ -87,7 +87,6 @@ export function upsertPathStep(statePathSteps: (PathStep | null)[], op: Suggeste
'coordinates',
'positionOnPath',
'name',
- 'ch',
'kp',
'stopFor',
'arrival',
@@ -98,7 +97,7 @@ export function upsertPathStep(statePathSteps: (PathStep | null)[], op: Suggeste
]),
id: nextId(),
...(op.uic
- ? { uic: op.uic }
+ ? { uic: op.uic, secondary_code: op.ch }
: {
track: op.track,
offset: op.offsetOnTrack,
diff --git a/front/src/reducers/osrdconf/osrdConfCommon/__tests__/utils.ts b/front/src/reducers/osrdconf/osrdConfCommon/__tests__/utils.ts
index d3d18475e71..48d974ddec0 100644
--- a/front/src/reducers/osrdconf/osrdConfCommon/__tests__/utils.ts
+++ b/front/src/reducers/osrdconf/osrdConfCommon/__tests__/utils.ts
@@ -436,7 +436,6 @@ const testCommonConfReducers = (slice: OperationalStudiesConfSlice | StdcmConfSl
locked: newVia.locked,
deleted: newVia.deleted,
name: newVia.name,
- ch: newVia.ch,
};
store.dispatch(slice.actions.upsertViaFromSuggestedOP(newVia));
diff --git a/front/src/reducers/osrdconf/types.ts b/front/src/reducers/osrdconf/types.ts
index 84383718a6f..47a4114e33c 100644
--- a/front/src/reducers/osrdconf/types.ts
+++ b/front/src/reducers/osrdconf/types.ts
@@ -81,7 +81,6 @@ export type PathStep = PathItemLocation & {
coordinates?: Position;
// Metadatas given by the search endpoint in TypeAndPath (name)
name?: string;
- ch?: string; // can be used to difference two steps from each other when they have same uic
// Metadatas given by ManageTrainScheduleMap click event to add origin/destination/via
metadata?: {
lineCode: number;
|