Browse Source

Bugfix/duplicate data point of today in chart of holding detail dialog (#8432)

* Fix duplicate data point of today in chart of holding detail dialog

* Update changelog
pull/8450/head
Thomas Kaul 1 week ago
committed by GitHub
parent
commit
fda19b6d23
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      CHANGELOG.md
  2. 23
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts

6
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/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Fixed
- Fixed the duplicate data point of today in the chart of the holding detail dialog
## 3.100.0 - 2026-11-15 ## 3.100.0 - 2026-11-15
### Changed ### Changed

23
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts

@ -70,7 +70,14 @@ import { MatTabsModule } from '@angular/material/tabs';
import { NavigationStart, Router, RouterModule } from '@angular/router'; import { NavigationStart, Router, RouterModule } from '@angular/router';
import { IonIcon } from '@ionic/angular/standalone'; import { IonIcon } from '@ionic/angular/standalone';
import { isUUID } from 'class-validator'; import { isUUID } from 'class-validator';
import { format, isSameMonth, isToday, parseISO } from 'date-fns'; import {
format,
isBefore,
isSameMonth,
isToday,
parseISO,
startOfToday
} from 'date-fns';
import { addIcons } from 'ionicons'; import { addIcons } from 'ionicons';
import { import {
arrowDownCircleOutline, arrowDownCircleOutline,
@ -374,8 +381,15 @@ export class GfHoldingDetailDialogComponent implements OnInit {
permissions.readMarketDataOfOwnAssetProfile permissions.readMarketDataOfOwnAssetProfile
); );
this.historicalDataItems = historicalData.map( const today = startOfToday();
({ averagePrice, date, marketPrice }) => {
this.historicalDataItems = historicalData
.filter(({ date }) => {
// Skip the market data from today on, the market price is added
// as the latest data point below
return isBefore(parseISO(date), today);
})
.map(({ averagePrice, date, marketPrice }) => {
this.benchmarkDataItems.push({ this.benchmarkDataItems.push({
date, date,
value: isNumber(averagePrice) ? averagePrice : null value: isNumber(averagePrice) ? averagePrice : null
@ -385,8 +399,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
date, date,
value: marketPrice ?? 0 value: marketPrice ?? 0
}; };
} });
);
this.investmentInBaseCurrencyWithCurrencyEffect = this.investmentInBaseCurrencyWithCurrencyEffect =
investmentInBaseCurrencyWithCurrencyEffect; investmentInBaseCurrencyWithCurrencyEffect;

Loading…
Cancel
Save