Skip to content

Commit 176ef03

Browse files
committed
front: remove some conditions in SimulationResults
- Removed the first condition trainSimulation.status === 'success' to allow the user to see the SpaceTimeChart even if the current selected train is invalid. - Removed not needed condition on pathproperties to display the spacetimechart Signed-off-by: Clara Ni <clara.ni@outlook.fr>
1 parent 5386f61 commit 176ef03

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

front/src/applications/operationalStudies/views/SimulationResults.tsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@ const SimulationResults = ({
117117
}
118118
}, [extViewport]);
119119

120-
if (!trainSimulation) return null;
121-
122-
if (trainSimulation.status !== 'success') return null;
123-
124120
return (
125121
<div className="simulation-results">
126122
{/* SIMULATION : STICKY BAR */}
@@ -151,7 +147,7 @@ const SimulationResults = ({
151147
className="simulation-warped-map d-flex flex-row align-items-stretch mb-2"
152148
style={{ height: manchetteWithSpaceTimeChartHeight }}
153149
>
154-
{projectionData && projectionData.projectedTrains.length > 0 && pathProperties && (
150+
{projectionData && projectionData.projectedTrains.length > 0 && (
155151
<>
156152
<button
157153
type="button"

front/src/modules/timesStops/TimesStopsOutput.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import TimesStops from './TimesStops';
1414
import { TableType, type TimeStopsRow } from './types';
1515

1616
type TimesStopsOutputProps = {
17-
simulatedTrain: SimulationResponseSuccess;
17+
simulatedTrain?: SimulationResponseSuccess;
1818
trainSummary?: TrainScheduleWithDetails;
1919
operationalPoints?: PathPropertiesFormatted['operationalPoints'];
2020
selectedTrainSchedule?: TrainScheduleResult;
@@ -31,7 +31,7 @@ const TimesStopsOutput = ({
3131
dataIsLoading,
3232
}: TimesStopsOutputProps) => {
3333
const enrichedOperationalPoints = useOutputTableData(
34-
simulatedTrain,
34+
simulatedTrain?.final_output,
3535
trainSummary,
3636
operationalPoints,
3737
selectedTrainSchedule,

front/src/modules/timesStops/hooks/useOutputTableData.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { formatSchedule } from '../helpers/scheduleData';
2020
import { type ScheduleEntry, type TimeStopsRow } from '../types';
2121

2222
const useOutputTableData = (
23-
{ final_output: simulatedTrain }: SimulationResponseSuccess,
23+
simulatedTrain?: SimulationResponseSuccess['final_output'],
2424
trainSummary?: TrainScheduleWithDetails,
2525
operationalPoints?: PathPropertiesFormatted['operationalPoints'],
2626
selectedTrainSchedule?: TrainScheduleResult,
@@ -104,7 +104,7 @@ const useOutputTableData = (
104104
}, [selectedTrainSchedule, path, trainSummary?.pathItemTimes, startDatetime]);
105105

106106
const rows: TimeStopsRow[] = useMemo(() => {
107-
if (!operationalPoints || !startDatetime) return [];
107+
if (!operationalPoints || !startDatetime || !simulatedTrain) return [];
108108

109109
return operationalPoints.map((op) => {
110110
const matchingPathStep = pathStepRows.find(

0 commit comments

Comments
 (0)