From 80bb1b1f645e78d6b51e269a45121c8a068feb74 Mon Sep 17 00:00:00 2001 From: Francisco Crizul Date: Fri, 10 Jan 2025 15:59:19 -0300 Subject: [PATCH] Bugfix/fix issue with renaming of activities with type FEE, INTEREST, ITEM or LIABILITY (#4183) * Fix issue with renaming of activities with type FEE, INTEREST, ITEM or LIABILITY * Update changelog --- CHANGELOG.md | 6 ++++++ ...ate-or-update-activity-dialog.component.ts | 19 ++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58f0c037a..5d3bcedf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Fixed + +- Fixed an issue with the renaming of activities with type `FEE`, `INTEREST`, `ITEM` or `LIABILITY` + ## 2.133.1 - 2025-01-09 ### 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 506a46a31..271a5cd53 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 @@ -1,7 +1,5 @@ import { CreateOrderDto } from '@ghostfolio/api/app/order/create-order.dto'; import { UpdateOrderDto } from '@ghostfolio/api/app/order/update-order.dto'; -import { DataService } from '@ghostfolio/client/services/data.service'; -import { validateObjectForForm } from '@ghostfolio/client/util/form.util'; import { getDateFormatString } from '@ghostfolio/common/helper'; import { translate } from '@ghostfolio/ui/i18n'; @@ -24,6 +22,8 @@ import { isAfter, isToday } from 'date-fns'; import { EMPTY, Observable, Subject, lastValueFrom, of } from 'rxjs'; import { catchError, delay, map, startWith, takeUntil } from 'rxjs/operators'; +import { DataService } from '../../../../services/data.service'; +import { validateObjectForForm } from '../../../../util/form.util'; import { CreateOrUpdateActivityDialogParams } from './interfaces/interfaces'; @Component({ @@ -124,7 +124,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { name: [this.data.activity?.SymbolProfile?.name, Validators.required], quantity: [this.data.activity?.quantity, Validators.required], searchSymbol: [ - !!this.data.activity?.SymbolProfile + this.data.activity?.SymbolProfile ? { dataSource: this.data.activity?.SymbolProfile?.dataSource, symbol: this.data.activity?.SymbolProfile?.symbol @@ -476,7 +476,11 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { fee: this.activityForm.get('fee').value, quantity: this.activityForm.get('quantity').value, symbol: - this.activityForm.get('searchSymbol')?.value?.symbol ?? + (['FEE', 'INTEREST', 'ITEM', 'LIABILITY'].includes( + this.activityForm.get('type').value + ) + ? undefined + : this.activityForm.get('searchSymbol')?.value?.symbol) ?? this.activityForm.get('name')?.value, tags: this.activityForm.get('tags').value, type: this.activityForm.get('type').value, @@ -485,8 +489,9 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { try { if (this.mode === 'create') { - (activity as CreateOrderDto).updateAccountBalance = - this.activityForm.get('updateAccountBalance').value; + activity.updateAccountBalance = this.activityForm.get( + 'updateAccountBalance' + ).value; await validateObjectForForm({ classDto: CreateOrderDto, @@ -495,7 +500,7 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { object: activity }); - this.dialogRef.close(activity as CreateOrderDto); + this.dialogRef.close(activity); } else { (activity as UpdateOrderDto).id = this.data.activity.id;