File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -883,13 +883,15 @@ export class TrainrunSectionService implements OnDestroy {
883883 let stopTime : number ;
884884 while ( iterator . hasNext ( ) ) {
885885 const nextPair = iterator . next ( ) ;
886+ const rightIsTarget =
887+ nextPair . node . getId ( ) === nextPair . trainrunSection . getTargetNode ( ) . getId ( ) ;
886888
887889 if ( prevInitialTargetArrival !== null ) {
888- stopTime = MathUtils . mod60 ( nextPair . trainrunSection . getSourceDeparture ( ) - prevInitialTargetArrival ) ;
890+ stopTime = MathUtils . mod60 ( ( rightIsTarget ? nextPair . trainrunSection . getSourceDeparture ( ) : nextPair . trainrunSection . getTargetDeparture ( ) ) - prevInitialTargetArrival ) ;
889891 trsTimeStructure . leftDepartureTime = trsTimeStructure . rightArrivalTime + stopTime ;
890892 trsTimeStructure . leftArrivalTime = trsTimeStructure . rightDepartureTime - stopTime ;
891893 }
892- prevInitialTargetArrival = nextPair . trainrunSection . getTargetArrival ( ) ;
894+ prevInitialTargetArrival = rightIsTarget ? nextPair . trainrunSection . getTargetArrival ( ) : nextPair . trainrunSection . getSourceArrival ( ) ;
893895
894896 const isLastRightNode = ! nextPair . node . isNonStop ( nextPair . trainrunSection ) && ! nextPair . node . getIsCollapsed ( ) ;
895897 trsTimeStructure . travelTime = isLastRightNode ?
@@ -911,8 +913,7 @@ export class TrainrunSectionService implements OnDestroy {
911913 trsTimeStructure ,
912914 precision ,
913915 ) ;
914- const rightIsTarget =
915- nextPair . node . getId ( ) === nextPair . trainrunSection . getTargetNode ( ) . getId ( ) ;
916+
916917 this . updateTrainrunSectionTime (
917918 nextPair . trainrunSection . getId ( ) ,
918919 rightIsTarget ? trsTimeStructure . leftArrivalTime : trsTimeStructure . rightArrivalTime ,
You can’t perform that action at this time.
0 commit comments