File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -696,6 +696,21 @@ export class TrainrunService {
696696 } ;
697697 }
698698
699+ getFirstTrainrunSection ( trainrun : Trainrun ) : TrainrunSection | undefined {
700+ const sections = this . trainrunSectionService . getAllTrainrunSectionsForTrainrun (
701+ trainrun . getId ( ) ,
702+ ) ;
703+ if ( sections . length === 0 ) {
704+ return undefined ;
705+ }
706+ // sections[0] does not ensure to be the first section in the trainrun
707+ const iterator = this . getBackwardIterator ( sections [ 0 ] . getTargetNode ( ) , sections [ 0 ] ) ;
708+ while ( iterator . hasNext ( ) ) {
709+ iterator . next ( ) ;
710+ }
711+ return iterator . current ( ) . trainrunSection ;
712+ }
713+
699714 getFirstNonStopTrainrunSection ( trainrunSection : TrainrunSection ) : TrainrunSection {
700715 // starts at the target node, goes backwards to find the first section that is not a non-stop section
701716 const iterator = this . getBackwardNonStopIterator (
You can’t perform that action at this time.
0 commit comments