Skip to content

Commit a623d3f

Browse files
authored
Fix: Graphical Timetable (Streckengrafik) – Section Track Estimator Not Working for Train with direction changes (#614)
* Fix: the reported issue * lint fix * fix: This part can be significantly simplified due to all the changes that have been introduced for one-way train runs.
1 parent 616b8d2 commit a623d3f

File tree

1 file changed

+6
-27
lines changed

1 file changed

+6
-27
lines changed

src/app/streckengrafik/services/sg-6-track.service.ts

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,12 @@ export class Sg6TrackService implements OnDestroy {
112112
if (trainrunItem.isSection()) {
113113
const ps: SgTrainrunSection = trainrunItem.getTrainrunSection();
114114
if (ps.trainrunBranchType === TrainrunBranchType.Trainrun) {
115-
if (ps.departurePathNode && ps.arrivalPathNode) {
116-
const sectionKey = this.getSectionKey(ps, separateForwardBackwardTracks).key;
117-
const sOfI = sectionsOfInterest.get(sectionKey);
118-
if (sOfI === undefined) {
119-
sectionsOfInterest.set(sectionKey, []);
120-
}
121-
sectionsOfInterest.get(sectionKey).push({item: trainrunItem, trainrun: ts});
115+
const sectionKey = this.getSectionKey(ps, separateForwardBackwardTracks).key;
116+
const sOfI = sectionsOfInterest.get(sectionKey);
117+
if (sOfI === undefined) {
118+
sectionsOfInterest.set(sectionKey, []);
122119
}
120+
sectionsOfInterest.get(sectionKey).push({item: trainrunItem, trainrun: ts});
123121
}
124122
}
125123
});
@@ -130,31 +128,12 @@ export class Sg6TrackService implements OnDestroy {
130128
private getSectionKey(ps: SgTrainrunSection, separateForwardBackwardTracks: boolean) {
131129
let node1 = ps.arrivalPathNode === undefined ? undefined : ps.arrivalPathNode.nodeId;
132130
let node2 = ps.departurePathNode === undefined ? undefined : ps.departurePathNode.nodeId;
133-
let key1 =
134-
(ps.arrivalPathNode === undefined
135-
? "undefined_" + separateForwardBackwardTracks
136-
: ps.arrivalPathNode.nodeShortName) +
137-
"_" +
138-
node1 +
139-
"_" +
140-
ps.index;
141-
let key2 =
142-
(ps.departurePathNode === undefined
143-
? "undefined_" + separateForwardBackwardTracks
144-
: ps.departurePathNode.nodeShortName) +
145-
"_" +
146-
node2 +
147-
"_" +
148-
ps.index;
149131
if (node1 > node2) {
150132
const tmp = node1;
151133
node1 = node2;
152134
node2 = tmp;
153-
const keyTmp = key1;
154-
key1 = key2;
155-
key2 = keyTmp;
156135
}
157-
const sectionKey = key1 + "#" + key2;
136+
const sectionKey = "@" + ps.index;
158137
return {key: sectionKey, node1: node1, node2: node2};
159138
}
160139

0 commit comments

Comments
 (0)