Skip to content

Commit c2fd444

Browse files
committed
fix(perlenkette): stop nunmberOfStops multiplication on each add/remove of a collapsed node
1 parent 0a58a79 commit c2fd444

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,10 +1033,13 @@ export class TrainrunSectionService implements OnDestroy {
10331033
if (!node.isEmpty()) break;
10341034
if (!node.isNonStopNode() && node.getIsCollapsed()) {
10351035
// undock the empty node of the trainrun
1036-
this.nodeService.undockTransition(
1036+
const mergedSection = this.nodeService.undockTransition(
10371037
node.getId(),
10381038
node.getTransition(trainrunSection.getId()).getId(),
10391039
);
1040+
if (mergedSection) {
1041+
mergedSection.setNumberOfStops(Math.max(0, mergedSection.getNumberOfStops() - 1));
1042+
}
10401043
// remove node only if it is not used anymore
10411044
if (node.getTransitions().length === 0) {
10421045
// unselect details

0 commit comments

Comments
 (0)