Skip to content

Commit f1665a2

Browse files
committed
front: fix map waypoints not displayed in speedspace chart an output table
Add an util to centralize the insertion of map waypoints in an operational points array Signed-off-by: SharglutDev <[email protected]>
1 parent 861a6d2 commit f1665a2

File tree

8 files changed

+484
-51
lines changed

8 files changed

+484
-51
lines changed

front/scripts/i18n-checker.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ const IGNORE_MISSING: RegExp[] = [
1313
/translation:default/,
1414
/translation:error/,
1515
/translation:unspecified/,
16+
// key used by upsertMapWaypointsInOperationalPoints
17+
/translation:requestedPoint/,
1618
];
1719
const IGNORE_UNUSED: RegExp[] = [
1820
/.*-generated$/,

front/src/applications/operationalStudies/__tests__/sampleData.ts

+138-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import type {
77
ElectrificationValue,
88
PositionData,
99
} from 'applications/operationalStudies/types';
10-
import type { SimulationSummaryResult, TrainScheduleResult } from 'common/api/osrdEditoastApi';
10+
import type {
11+
PathProperties,
12+
SimulationSummaryResult,
13+
TrainScheduleResult,
14+
} from 'common/api/osrdEditoastApi';
1115

1216
export const pathLength = 4000;
1317

@@ -551,3 +555,136 @@ export const trainSummaryHonored: Extract<SimulationSummaryResult, { status: 'su
551555
path_item_times_provisional: [0, 2186885],
552556
path_item_times_base: [0, 2186885],
553557
};
558+
559+
// Data for upsertMapWaypointsInOperationalPoints
560+
561+
export const pathInputsWithOneMapWaypoint: TrainScheduleResult['path'] = [
562+
{
563+
id: '1',
564+
secondary_code: 'BV',
565+
uic: 2,
566+
},
567+
{
568+
id: '2',
569+
offset: 7746000,
570+
track: 'TA6',
571+
},
572+
{
573+
id: '3',
574+
secondary_code: 'BV',
575+
uic: 4,
576+
},
577+
];
578+
579+
export const pathInputsWithNoMapWaypoint: TrainScheduleResult['path'] = [
580+
{
581+
id: '1',
582+
secondary_code: 'BV',
583+
uic: 2,
584+
},
585+
{
586+
id: '2',
587+
secondary_code: 'BV',
588+
uic: 3,
589+
},
590+
{
591+
id: '3',
592+
secondary_code: 'BV',
593+
uic: 4,
594+
},
595+
];
596+
597+
export const sampleWithMultipleOperationalPoints: NonNullable<
598+
PathProperties['operational_points']
599+
> = [
600+
{
601+
id: 'West_station',
602+
part: {
603+
track: 'TA1',
604+
position: 500,
605+
},
606+
extensions: {
607+
identifier: {
608+
name: 'West_station',
609+
uic: 2,
610+
},
611+
},
612+
position: 0,
613+
},
614+
{
615+
id: 'Mid_West_station',
616+
part: {
617+
track: 'TC1',
618+
position: 550,
619+
},
620+
extensions: {
621+
identifier: {
622+
name: 'Mid_West_station',
623+
uic: 3,
624+
},
625+
},
626+
position: 12050000,
627+
},
628+
{
629+
id: 'Mid_East_station',
630+
part: {
631+
track: 'TD0',
632+
position: 14000,
633+
},
634+
extensions: {
635+
identifier: {
636+
name: 'Mid_East_station',
637+
uic: 4,
638+
},
639+
},
640+
position: 26500000,
641+
},
642+
];
643+
644+
export const pathInputWithWaypointsByMapOnly: TrainScheduleResult['path'] = [
645+
{
646+
id: '1',
647+
offset: 6481000,
648+
track: 'TA6',
649+
},
650+
{
651+
id: '2',
652+
offset: 4733000,
653+
track: 'TA6',
654+
},
655+
];
656+
657+
export const pathInputsEndingWithTwoWaypointsByMap: TrainScheduleResult['path'] = [
658+
{
659+
id: '1',
660+
offset: 6481000,
661+
track: 'TA6',
662+
},
663+
{
664+
id: '2',
665+
offset: 679000,
666+
track: 'TC0',
667+
},
668+
{
669+
id: '3',
670+
offset: 883000,
671+
track: 'TC0',
672+
},
673+
];
674+
675+
export const sampleWithOneOperationalPoint: NonNullable<PathProperties['operational_points']> = [
676+
{
677+
id: 'Mid_West_station',
678+
part: {
679+
track: 'TC0',
680+
position: 550,
681+
},
682+
extensions: {
683+
identifier: {
684+
name: 'Mid_West_station',
685+
uic: 3,
686+
},
687+
},
688+
position: 4069000,
689+
},
690+
];

0 commit comments

Comments
 (0)