File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
front/src/modules/timesStops Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import type {
1313 PathItemLocation ,
1414 ReceptionSignal ,
1515 TrackReference ,
16+ TrackSection ,
1617} from 'common/api/osrdEditoastApi' ;
1718import type { TimeString } from 'common/types' ;
1819import { matchPathStepAndOp } from 'modules/pathfinding/utils' ;
@@ -351,9 +352,15 @@ export function receptionSignalToSignalBooleans(receptionSignal?: ReceptionSigna
351352 return { shortSlipDistance : false , onStopSignal : false } ;
352353}
353354
354- export const getTrackReferenceLabel = ( trackReference ?: TrackReference | null ) => {
355+ export const getTrackReferenceLabel = (
356+ trackSections : Record < string , TrackSection > ,
357+ trackReference ?: TrackReference | null
358+ ) => {
355359 if ( ! trackReference ) return undefined ;
356- return 'track_id' in trackReference ? trackReference . track_id : trackReference . track_name ;
360+ if ( 'track_name' in trackReference ) return trackReference . track_name ;
361+ return (
362+ trackSections [ trackReference . track_id ] ?. extensions ?. sncf ?. track_name ?? trackReference . track_id
363+ ) ;
357364} ;
358365
359366export const getOperationalPointName = (
Original file line number Diff line number Diff line change @@ -39,7 +39,12 @@ const useOutputTableData = (
3939
4040 const trackIds = useMemo ( ( ) => {
4141 const path = selectedTrain ?. path || [ ] ;
42- const trackIdsInPathSteps = path . flatMap ( ( step ) => ( 'track' in step ? [ step . track ] : [ ] ) ) ;
42+ const trackIdsInPathSteps = path . flatMap ( ( step ) => [
43+ ...( 'track' in step ? [ step . track ] : [ ] ) ,
44+ ...( 'track_reference' in step && step . track_reference && 'track_id' in step . track_reference
45+ ? [ step . track_reference . track_id ]
46+ : [ ] ) ,
47+ ] ) ;
4348 const trackIdsOnPath = ( operationalPointsOnPath || [ ] ) . map ( ( op ) => op . part . track ) ;
4449 return [ ...trackIdsInPathSteps , ...trackIdsOnPath ] ;
4550 } , [ selectedTrain ?. path , operationalPointsOnPath ] ) ;
@@ -80,7 +85,7 @@ const useOutputTableData = (
8085 const trackName =
8186 'track' in pathStep
8287 ? trackSections [ pathStep . track ] ?. extensions ?. sncf ?. track_name
83- : getTrackReferenceLabel ( pathStep . track_reference ) ;
88+ : getTrackReferenceLabel ( trackSections , pathStep . track_reference ) ;
8489
8590 const schedule = scheduleByAt [ pathStep . id ] ;
8691 const computedArrival = simulatedPathItemTimes
You can’t perform that action at this time.
0 commit comments