Skip to content

Commit

Permalink
front: renaming in lmr
Browse files Browse the repository at this point in the history
- adjusting test logic after stdcm changes

Signed-off-by: Mathieu <[email protected]>
  • Loading branch information
Caracol3 committed Dec 12, 2024
1 parent 1869fad commit 9a41ac3
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 11 deletions.
7 changes: 4 additions & 3 deletions front/public/locales/en/stdcm.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"downloadSimulationSheet": "Download simulation report sheet",
"formatCreationDate": "{{month}}/{{day}}/{{year}} {{hours}}:{{minutes}}",
"gesicoRequest": "and attach this document to your GESICO DSDM request.",
"notFound": "No solution was found for this configuration",
"notFound": "No path was found for this configuration",
"conflictsTitle": "Here are the problems encountered when calculating the shortest path:",
"trackConflict": "conflict with a train path between <strong>{{waypointBefore}}</strong> and <strong>{{waypointAfter}}</strong> from {{startDate}} at {{startTime}} to {{endDate}} at {{endTime}}",
"trackConflictSameDay": "conflict with a train path between <strong>{{waypointBefore}}</strong> and <strong>{{waypointAfter}}</strong> on {{startDate}} between {{startTime}} and {{endTime}}",
Expand All @@ -60,14 +60,14 @@
"retainThisSimulation": "Retain this simulation",
"simulationName": {
"withOutputs": "Simulation n°{{id}}",
"withoutOutputs": "Without result"
"withoutOutputs": "No capacity"
},
"simulationSelected": "You have selected this simulation",
"startNewQuery": "Start a new query",
"status": {
"completed": "Calculation completed",
"errorMessage": "We are sorry that we could not process your request. The LMR team has been notified and will be aware of the situation as soon as possible.",
"failed": "A technical problem occurred"
"failed": "A technical issue has occurred"
},
"upgrade": {
"arrivalIncompatible": "Arrival time incompatible",
Expand Down Expand Up @@ -106,6 +106,7 @@
"origin": "Origin",
"posteriorPath": "Posterior path",
"preciseTime": "precise time",
"respectDestinationSchedule": "respect the destination schedule",
"stopFor": "Minimum stop time",
"stopType": {
"driverSwitch": "driver switch",
Expand Down
5 changes: 3 additions & 2 deletions front/public/locales/fr/stdcm.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"downloadSimulationSheet": "Télécharger la fiche de simulation",
"formatCreationDate": "{{day}}/{{month}}/{{year}} {{hours}}:{{minutes}}",
"gesicoRequest": "et joignez ce document à votre demande GESICO DSDM",
"notFound": "Aucune solution n'a été trouvée pour cette configuration",
"notFound": "Aucun passage n'a été trouvé pour cette configuration",
"conflictsTitle": "Voici les problèmes rencontrés au moment du calcul sur le chemin le plus court :",
"trackConflict": "conflit avec un autre sillon entre <strong>{{waypointBefore}}</strong> et <strong>{{waypointAfter}}</strong> du {{startDate}} à {{startTime}} au {{endDate}} à {{endTime}}",
"trackConflictSameDay": "conflit avec un sillon entre <strong>{{waypointBefore}}</strong> et <strong>{{waypointAfter}}</strong> le {{startDate}} entre {{startTime}} et {{endTime}}",
Expand All @@ -60,7 +60,7 @@
"retainThisSimulation": "Retenir cette simulation",
"simulationName": {
"withOutputs": "Simulation n°{{id}}",
"withoutOutputs": "Sans résultat"
"withoutOutputs": "Pas de capacité"
},
"simulationSelected": "Vous avez retenu cette simulation",
"startNewQuery": "Démarrez une nouvelle requête",
Expand Down Expand Up @@ -106,6 +106,7 @@
"origin": "Origine",
"posteriorPath": "Sillon postérieur",
"preciseTime": "horaire précis",
"respectDestinationSchedule": "respecter l'horaire de la destination",
"stopFor": "Temps d'arrêt minimum",
"stopType": {
"driverSwitch": "relève conducteur",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type StdcmOpScheduleProps = {
arrivalToleranceAfter: number;
};
opId: string;
isOrigin?: boolean;
};

const defaultDate = (date?: Date) => {
Expand All @@ -52,6 +53,7 @@ const StdcmOpSchedule = ({
opScheduleTimeType,
opToleranceValues,
opId,
isOrigin = false,
}: StdcmOpScheduleProps) => {
const { t } = useTranslation('stdcm');
const { getSearchDatetimeWindow } = useOsrdConfSelectors();
Expand Down Expand Up @@ -110,7 +112,11 @@ const StdcmOpSchedule = ({
onArrivalTypeChange(e as ArrivalTimeTypes);
}
}}
{...createStringSelectOptions(['preciseTime', 'asSoonAsPossible'])}
{...createStringSelectOptions(
isOrigin
? ['preciseTime', 'respectDestinationSchedule']
: ['preciseTime', 'asSoonAsPossible']
)}
getOptionLabel={(option) => t(`trainPath.${option}`)}
disabled={disabled}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const StdcmOrigin = ({ disabled = false }: StdcmConfigCardProps) => {
opScheduleTimeType={origin.arrivalType}
disabled={disabled}
opId="origin-arrival"
isOrigin
/>
</StdcmCard>
);
Expand Down
1 change: 1 addition & 0 deletions front/src/applications/stdcm/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export type StdcmConfigCardProps = {
export enum ArrivalTimeTypes {
PRECISE_TIME = 'preciseTime',
ASAP = 'asSoonAsPossible',
RESPECT_DESTINATION_SCHEDULE = 'respectDestinationSchedule',
}

export enum StdcmConfigErrorTypes {
Expand Down
11 changes: 7 additions & 4 deletions front/src/applications/stdcm/utils/checkStdcmConfigErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ const checkStdcmConfigErrors = (
return { errorType: StdcmConfigErrorTypes.PATHFINDING_FAILED };
}

const areBothPointsASAP =
origin.arrivalType === ArrivalTimeTypes.ASAP &&
destination.arrivalType === ArrivalTimeTypes.ASAP;
const isOriginRespectDestinationSchedule =
origin.arrivalType === ArrivalTimeTypes.RESPECT_DESTINATION_SCHEDULE;

if (areBothPointsASAP) {
const isDestinationASAP = destination.arrivalType === ArrivalTimeTypes.ASAP;

const areBothPointsNotSchedule = isOriginRespectDestinationSchedule && isDestinationASAP;

if (areBothPointsNotSchedule) {
return { errorType: StdcmConfigErrorTypes.NO_SCHEDULED_POINT };
}

Expand Down
2 changes: 1 addition & 1 deletion front/tests/pages/stdcm-page-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class STDCMPage {
await expect(this.timeOriginArrival).toHaveValue('');
await expect(this.toleranceOriginArrival).toHaveValue('-30/+30');
await this.dynamicOriginCh.selectOption('BC');
await this.originArrival.selectOption('asSoonAsPossible');
await this.originArrival.selectOption('respectDestinationSchedule');
await expect(this.dateOriginArrival).not.toBeVisible();
await expect(this.timeOriginArrival).not.toBeVisible();
await expect(this.toleranceOriginArrival).not.toBeVisible();
Expand Down

0 comments on commit 9a41ac3

Please sign in to comment.