Skip to content

Commit e0b9f7e

Browse files
committed
Replace condition that kept orders sane
1 parent 3011f07 commit e0b9f7e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

alcs-frontend/src/app/features/application/decision/decision-v2/decision-input/decision-conditions/decision-condition-order-dialog/decision-condition-order-dialog.component.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ export class DecisionConditionOrderDialogComponent implements OnInit {
9090

9191
sendToBottom(record: ApplicationDecisionConditionDto) {
9292
this.conditionsToOrder.forEach((item) => {
93-
item.order--;
93+
if (item.order > record.order) {
94+
item.order--;
95+
}
9496
});
9597
record.order = this.conditionsToOrder.length - 1;
9698
this.dataSource.data = this.conditionsToOrder.sort((a, b) => a.order - b.order);
@@ -100,7 +102,9 @@ export class DecisionConditionOrderDialogComponent implements OnInit {
100102

101103
sendToTop(record: ApplicationDecisionConditionDto) {
102104
this.conditionsToOrder.forEach((item) => {
103-
item.order++;
105+
if (item.order < record.order) {
106+
item.order++;
107+
}
104108
});
105109
record.order = 0;
106110
this.dataSource.data = this.conditionsToOrder.sort((a, b) => a.order - b.order);

0 commit comments

Comments
 (0)