Skip to content

Commit 70b46e3

Browse files
authored
fix: The migration of the third-party import was not correctly performed during the one-way feature implementation. (#620)
1 parent 6e81f56 commit 70b46e3

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/app/view/editor-tools-view-component/editor-tools-view.component.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {StammdatenService} from "../../services/data/stammdaten.service";
1111
import {LogService} from "../../logger/log.service";
1212
import {VersionControlService} from "../../services/data/version-control.service";
1313
import {
14+
Direction,
1415
HaltezeitFachCategories,
1516
NetzgrafikDto,
1617
NodeDto,
@@ -27,6 +28,7 @@ import {TrainrunSectionValidator} from "../../services/util/trainrunsection.vali
2728
import {OriginDestinationService} from "src/app/services/analytics/origin-destination/components/origin-destination.service";
2829
import {EditorMode} from "../editor-menu/editor-mode";
2930
import {NODE_TEXT_AREA_HEIGHT, RASTERING_BASIC_GRID_SIZE} from "../rastering/definitions";
31+
import {ResourceService} from "../../services/data/resource.service";
3032

3133
interface 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

Comments
 (0)