@@ -11,6 +11,7 @@ import {StammdatenService} from "../../services/data/stammdaten.service";
1111import { LogService } from "../../logger/log.service" ;
1212import { VersionControlService } from "../../services/data/version-control.service" ;
1313import {
14+ Direction ,
1415 HaltezeitFachCategories ,
1516 NetzgrafikDto ,
1617 NodeDto ,
@@ -27,6 +28,7 @@ import {TrainrunSectionValidator} from "../../services/util/trainrunsection.vali
2728import { OriginDestinationService } from "src/app/services/analytics/origin-destination/components/origin-destination.service" ;
2829import { EditorMode } from "../editor-menu/editor-mode" ;
2930import { NODE_TEXT_AREA_HEIGHT , RASTERING_BASIC_GRID_SIZE } from "../rastering/definitions" ;
31+ import { ResourceService } from "../../services/data/resource.service" ;
3032
3133interface ContainertoExportData {
3234 documentToExport : HTMLElement ;
@@ -63,6 +65,7 @@ export class EditorToolsViewComponent {
6365 private viewportCullService : ViewportCullService ,
6466 private levelOfDetailService : LevelOfDetailService ,
6567 private originDestinationService : OriginDestinationService ,
68+ private resourceService : ResourceService ,
6669 ) { }
6770
6871 onLoadButton ( ) {
@@ -764,12 +767,24 @@ export class EditorToolsViewComponent {
764767 }
765768 trans . setIsNonStopTransit ( arrivalTime - departureTime === 0 ) ;
766769 } ) ;
770+
771+ const res = this . resourceService . createAndGetResource ( false ) ;
772+ n . setResourceId ( res . getId ( ) ) ;
773+ } ) ;
774+
775+ // step(4) Migrate 3rd party imported trainruns/node/resource to ensure direction is set
776+ this . dataService . ensureAllResourcesLinkedToNetzgrafikObjects ( ) ;
777+ this . trainrunService . getTrainruns ( ) . forEach ( ( t ) => {
778+ const currentDirection = t . getDirection ( ) ;
779+ if ( currentDirection === undefined ) {
780+ t . setDirection ( Direction . ROUND_TRIP ) ;
781+ }
767782 } ) ;
768783
769- // step(4 ) Recalc/propagate consecutive times
784+ // step(5 ) Recalc/propagate consecutive times
770785 this . trainrunService . propagateInitialConsecutiveTimes ( ) ;
771786
772- // step(5 ) Validate all trainrun sections
787+ // step(6 ) Validate all trainrun sections
773788 this . trainrunSectionService . getTrainrunSections ( ) . forEach ( ( ts ) => {
774789 TrainrunSectionValidator . validateOneSection ( ts ) ;
775790 TrainrunSectionValidator . validateTravelTime ( ts ) ;
0 commit comments