From 8cb9a1d508000067f9ec87fa633682bec71846b7 Mon Sep 17 00:00:00 2001 From: Huffle Date: Mon, 26 May 2025 09:50:20 +0200 Subject: [PATCH] make it so you only can edit weight of main allowance --- .../src/app/pages/edit-allowance/edit-allowance.page.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/allowance-planner-v2/src/app/pages/edit-allowance/edit-allowance.page.ts b/frontend/allowance-planner-v2/src/app/pages/edit-allowance/edit-allowance.page.ts index e8595d4..a47e7a3 100644 --- a/frontend/allowance-planner-v2/src/app/pages/edit-allowance/edit-allowance.page.ts +++ b/frontend/allowance-planner-v2/src/app/pages/edit-allowance/edit-allowance.page.ts @@ -34,13 +34,13 @@ export class EditAllowancePage implements OnInit { private router: Router ) { this.userId = this.route.snapshot.params['id']; - this.goalId = +this.route.snapshot.params['goalId']; + this.goalId = this.route.snapshot.params['goalId']; this.isAddMode = !this.goalId; this.allowanceService.getAllowanceList(this.userId).subscribe((list) => { for (let allowance of list) { this.possibleColors = this.possibleColors.filter(color => color !== allowance.colour); - if (!this.isAddMode && this.goalId === allowance.id) { + if (!this.isAddMode && +this.goalId === allowance.id) { this.possibleColors.unshift(allowance.colour); } } @@ -57,7 +57,7 @@ export class EditAllowancePage implements OnInit { ngOnInit() { if (!this.isAddMode) { this.allowanceService.getAllowanceById(this.goalId, this.userId).subscribe((allowance) => { - if (this.goalId === 0) { + if (+this.goalId === 0) { this.form.setValue({ name: 'Main Allowance', target: 0,