Skip to content

Commit f5fb0da

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 9e8b4ab commit f5fb0da

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
@@ -116,10 +116,6 @@ const SimulationResults = ({
116116
}
117117
}, [extViewport]);
118118

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

front/src/modules/timesStops/TimesStopsOutput.tsx

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

1515
type TimesStopsOutputProps = {
16-
simulatedTrain: SimulationResponseSuccess;
16+
simulatedTrain?: SimulationResponseSuccess;
1717
trainSummary?: TrainScheduleWithDetails;
1818
operationalPoints?: PathPropertiesFormatted['operationalPoints'];
1919
selectedTrainSchedule?: TrainScheduleResult;
@@ -30,7 +30,7 @@ const TimesStopsOutput = ({
3030
dataIsLoading,
3131
}: TimesStopsOutputProps) => {
3232
const enrichedOperationalPoints = useOutputTableData(
33-
simulatedTrain,
33+
simulatedTrain?.final_output,
3434
trainSummary,
3535
operationalPoints,
3636
selectedTrainSchedule,

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

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

2323
const useOutputTableData = (
24-
{ final_output: simulatedTrain }: SimulationResponseSuccess,
24+
simulatedTrain?: SimulationResponseSuccess['final_output'],
2525
trainSummary?: TrainScheduleWithDetails,
2626
operationalPoints?: PathPropertiesFormatted['operationalPoints'],
2727
selectedTrainSchedule?: TrainScheduleResult,
@@ -109,7 +109,7 @@ const useOutputTableData = (
109109

110110
useEffect(() => {
111111
const formatRows = async () => {
112-
if (!operationalPoints || !startDatetime) {
112+
if (!operationalPoints || !startDatetime || !simulatedTrain) {
113113
setRows([]);
114114
return;
115115
}

0 commit comments

Comments
 (0)