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
pull/4170/head^2
Francisco Crizul 5 days ago committed by GitHub
parent ce85a14b11
commit 80bb1b1f64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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

@ -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;

Loading…
Cancel
Save