Browse Source

Add performance timeline

pull/8103/head
Thomas Kaul 5 days ago
parent
commit
e740d2ef7b
  1. 40
      apps/api/src/app/portfolio/portfolio.controller.ts
  2. 6
      apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts

40
apps/api/src/app/portfolio/portfolio.controller.ts

@ -4,7 +4,8 @@ import { Impersonation } from '@ghostfolio/api/decorators/impersonation.decorato
import { RequiresScope } from '@ghostfolio/api/decorators/requires-scope.decorator';
import {
hasNotDefinedValuesInObject,
nullifyValuesInObject
nullifyValuesInObject,
nullifyValuesInObjects
} from '@ghostfolio/api/helper/object.helper';
import { convertValuesToPercentages } from '@ghostfolio/api/helper/portfolio.helper';
import { PerformanceLoggingInterceptor } from '@ghostfolio/api/interceptors/performance-logging/performance-logging.interceptor';
@ -583,32 +584,27 @@ export class PortfolioController {
this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION') &&
this.request.user.subscription?.type === SubscriptionType.Basic
) {
performanceInformation.chart = performanceInformation.chart.map(
(item) => {
return nullifyValuesInObject(item, [
'dividendInBaseCurrency',
'totalInvestment',
'value'
]);
}
performanceInformation.chart = nullifyValuesInObjects(
performanceInformation.chart,
[
'dividendInBaseCurrency',
'totalInvestment',
'value',
...(groupBy === 'year'
? [
'investmentValueWithCurrencyEffect',
'netPerformance',
'netPerformanceInPercentage',
'netPerformanceInPercentageWithCurrencyEffect',
'netPerformanceWithCurrencyEffect'
]
: [])
]
);
performanceInformation.performance = nullifyValuesInObject(
performanceInformation.performance,
['dividendInBaseCurrency', 'netPerformance']
);
if (groupBy === 'year') {
performanceInformation.chart = performanceInformation.chart.map(
(item) => {
return nullifyValuesInObject(item, [
'netPerformance',
'netPerformanceInPercentage',
'netPerformanceInPercentageWithCurrencyEffect',
'netPerformanceWithCurrencyEffect'
]);
}
);
}
}
return performanceInformation;

6
apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts

@ -5,6 +5,7 @@ import {
DEFAULT_DATE_RANGE,
NUMERICAL_PRECISION_THRESHOLD_6_FIGURES
} from '@ghostfolio/common/config';
import { SubscriptionType } from '@ghostfolio/common/enums';
import { canOpenHoldingDetail } from '@ghostfolio/common/helper';
import {
InvestmentItem,
@ -454,7 +455,10 @@ export class GfAnalysisPageComponent implements OnInit {
this.fetchDividendsAndInvestments();
if (this.user?.settings?.isExperimentalFeatures) {
if (
this.user?.settings?.isExperimentalFeatures &&
this.user?.subscription?.type !== SubscriptionType.Basic
) {
this.fetchPerformanceByYear();
}

Loading…
Cancel
Save