Verify current benchmark before loading it (#2541)

* Verify current benchmark before loading it

* Update changelog

---------

Co-authored-by: Thomas <4159106+dtslvr@users.noreply.github.com>
This commit is contained in:
Basim Mohammed 2023-10-25 23:57:41 +05:30 committed by GitHub
parent 2dcc7e161c
commit 2992a0da4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 26 deletions

View File

@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Fixed the chart in the account detail dialog for accounts excluded from analysis - Fixed the chart in the account detail dialog for accounts excluded from analysis
- Verified the current benchmark before loading it on the analysis page
## 2.14.0 - 2023-10-21 ## 2.14.0 - 2023-10-21

View File

@ -309,7 +309,6 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
} }
private update() { private update() {
this.isLoadingBenchmarkComparator = true;
this.isLoadingInvestmentChart = true; this.isLoadingInvestmentChart = true;
this.dataService this.dataService
@ -385,35 +384,37 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
} }
private updateBenchmarkDataItems() { private updateBenchmarkDataItems() {
this.benchmarkDataItems = [];
if (this.user.settings.benchmark) { if (this.user.settings.benchmark) {
const { dataSource, symbol } = const { dataSource, symbol } =
this.benchmarks.find(({ id }) => { this.benchmarks.find(({ id }) => {
return id === this.user.settings.benchmark; return id === this.user.settings.benchmark;
}) ?? {}; }) ?? {};
this.dataService if (dataSource && symbol) {
.fetchBenchmarkBySymbol({ this.isLoadingBenchmarkComparator = true;
dataSource,
symbol, this.dataService
startDate: this.firstOrderDate .fetchBenchmarkBySymbol({
}) dataSource,
.pipe(takeUntil(this.unsubscribeSubject)) symbol,
.subscribe(({ marketData }) => { startDate: this.firstOrderDate
this.benchmarkDataItems = marketData.map(({ date, value }) => { })
return { .pipe(takeUntil(this.unsubscribeSubject))
date, .subscribe(({ marketData }) => {
value this.benchmarkDataItems = marketData.map(({ date, value }) => {
}; return {
date,
value
};
});
this.isLoadingBenchmarkComparator = false;
this.changeDetectorRef.markForCheck();
}); });
}
this.isLoadingBenchmarkComparator = false;
this.changeDetectorRef.markForCheck();
});
} else {
this.benchmarkDataItems = [];
this.isLoadingBenchmarkComparator = false;
} }
} }
} }

View File

@ -3,7 +3,7 @@
<div *ngIf="user?.settings?.viewMode !== 'ZEN'" class="my-4 text-center"> <div *ngIf="user?.settings?.viewMode !== 'ZEN'" class="my-4 text-center">
<gf-toggle <gf-toggle
[defaultValue]="user?.settings?.dateRange" [defaultValue]="user?.settings?.dateRange"
[isLoading]="isLoadingBenchmarkComparator" [isLoading]="isLoadingBenchmarkComparator || isLoadingInvestmentChart"
[options]="dateRangeOptions" [options]="dateRangeOptions"
(change)="onChangeDateRange($event.value)" (change)="onChangeDateRange($event.value)"
></gf-toggle> ></gf-toggle>
@ -23,7 +23,7 @@
[benchmarks]="benchmarks" [benchmarks]="benchmarks"
[colorScheme]="user?.settings?.colorScheme" [colorScheme]="user?.settings?.colorScheme"
[daysInMarket]="daysInMarket" [daysInMarket]="daysInMarket"
[isLoading]="isLoadingBenchmarkComparator" [isLoading]="isLoadingBenchmarkComparator || isLoadingInvestmentChart"
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
[performanceDataItems]="performanceDataItemsInPercentage" [performanceDataItems]="performanceDataItemsInPercentage"
[user]="user" [user]="user"
@ -149,7 +149,7 @@
[daysInMarket]="daysInMarket" [daysInMarket]="daysInMarket"
[historicalDataItems]="performanceDataItems" [historicalDataItems]="performanceDataItems"
[isInPercent]="hasImpersonationId || user.settings.isRestrictedView" [isInPercent]="hasImpersonationId || user.settings.isRestrictedView"
[isLoading]="isLoadingBenchmarkComparator" [isLoading]="isLoadingInvestmentChart"
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
[range]="user?.settings?.dateRange" [range]="user?.settings?.dateRange"
></gf-investment-chart> ></gf-investment-chart>