Skip to content

Commit fd4ba9c

Browse files
committed
asymmetry: fix perlenkette time update on non-stop trainruns
Signed-off-by: Louis Greiner <[email protected]>
1 parent f8abcbf commit fd4ba9c

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

src/app/services/data/trainrun-section-times.service.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,11 +1057,19 @@ export class TrainrunSectionTimesService {
10571057
trainrunSection: TrainrunSection = this.selectedTrainrunSection,
10581058
leftAndRightTimeStructure: LeftAndRightTimeStructure = this.timeStructure,
10591059
) {
1060-
this.trainrunSectionService.setTimeStructureToTrainrunSections(
1061-
leftAndRightTimeStructure,
1062-
trainrunSection,
1063-
this.filterService.getTimeDisplayPrecision(),
1064-
);
1060+
if (this.onPerlenkette) {
1061+
// non-stop trainruns in perlenkette: timeStructure is only for the section, not sections chain
1062+
this.trainrunSectionService.setTimeStructureToTrainrunSection(
1063+
leftAndRightTimeStructure,
1064+
trainrunSection,
1065+
);
1066+
} else {
1067+
this.trainrunSectionService.setTimeStructureToTrainrunSections(
1068+
leftAndRightTimeStructure,
1069+
trainrunSection,
1070+
this.filterService.getTimeDisplayPrecision(),
1071+
);
1072+
}
10651073
}
10661074

10671075
private isLeftNodeSymmetric(): boolean {

src/app/services/data/trainrunsection.service.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,31 @@ export class TrainrunSectionService implements OnDestroy {
10621062
this.nodeService.connectionsUpdated();
10631063
}
10641064

1065+
setTimeStructureToTrainrunSection(
1066+
leftAndRightTimeStructure: LeftAndRightTimeStructure,
1067+
updatedTrainrunSection: TrainrunSection,
1068+
) {
1069+
// Get rid of left/right paradigm
1070+
const timeStructure = this.getTimeStructureFromLeftAndRightTimeStructure(
1071+
TrainrunsectionHelper.isTargetRightOrBottom(updatedTrainrunSection),
1072+
leftAndRightTimeStructure,
1073+
);
1074+
1075+
this.updateTrainrunSectionTime(
1076+
updatedTrainrunSection.getId(),
1077+
timeStructure.sourceArrivalTime,
1078+
timeStructure.sourceDepartureTime,
1079+
timeStructure.targetArrivalTime,
1080+
timeStructure.targetDepartureTime,
1081+
timeStructure.travelTime,
1082+
timeStructure.backwardTravelTime,
1083+
false,
1084+
);
1085+
1086+
this.trainrunSectionsUpdated();
1087+
this.nodeService.connectionsUpdated();
1088+
}
1089+
10651090
trainrunSectionsUpdated() {
10661091
this.trainrunSectionsSubject.next(
10671092
Object.assign({}, this.trainrunSectionsStore).trainrunSections,

0 commit comments

Comments
 (0)