From ca992db14eb00e9dc0f6d51f7fdcb914770fea66 Mon Sep 17 00:00:00 2001 From: csehatt741 <77381875+csehatt741@users.noreply.github.com> Date: Wed, 30 Apr 2025 17:51:32 +0200 Subject: [PATCH] Bugfix/save activities with type INTEREST, ITEM and LIABILITY (#4630) * Save activities with type INTEREST, ITEM and LIABILITY * Update changelog --- CHANGELOG.md | 4 ++++ ...eate-or-update-activity-dialog.component.ts | 18 +++++------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cccc700d5..543851098 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Renamed `Order` to `activities` in the `Account` database schema - Improved the language localization for German (`de`) +### Fixed + +- Fixed an issue with the saving of activities with type `INTEREST`, `ITEM` and `LIABILITY` + ## 2.157.1 - 2025-04-29 ### Added diff --git a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts index f6ce2a81d..dce045a4a 100644 --- a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts +++ b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts @@ -238,7 +238,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { .get('dataSource') .removeValidators(Validators.required); this.activityForm.get('dataSource').updateValueAndValidity(); - this.activityForm.get('fee').reset(); + this.activityForm.get('fee').setValue(0); this.activityForm.get('name').setValidators(Validators.required); this.activityForm.get('name').updateValueAndValidity(); this.activityForm.get('quantity').setValue(1); @@ -248,11 +248,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { this.activityForm.get('searchSymbol').updateValueAndValidity(); this.activityForm.get('updateAccountBalance').disable(); this.activityForm.get('updateAccountBalance').setValue(false); - } else if ( - type === 'FEE' || - type === 'INTEREST' || - type === 'LIABILITY' - ) { + } else if (['FEE', 'INTEREST', 'LIABILITY'].includes(type)) { this.activityForm .get('accountId') .removeValidators(Validators.required); @@ -271,12 +267,8 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { .removeValidators(Validators.required); this.activityForm.get('dataSource').updateValueAndValidity(); - if ( - (type === 'FEE' && this.activityForm.get('fee').value === 0) || - type === 'INTEREST' || - type === 'LIABILITY' - ) { - this.activityForm.get('fee').reset(); + if (['INTEREST', 'LIABILITY'].includes(type)) { + this.activityForm.get('fee').setValue(0); } this.activityForm.get('name').setValidators(Validators.required); @@ -284,7 +276,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { if (type === 'FEE') { this.activityForm.get('quantity').setValue(0); - } else if (type === 'INTEREST' || type === 'LIABILITY') { + } else if (['INTEREST', 'LIABILITY'].includes(type)) { this.activityForm.get('quantity').setValue(1); }