Browse Source

revert: fireWealth interface in fire-calculator and update changelog

pull/5644/head
FlavienLM 3 months ago
parent
commit
7e246ed072
  1. 1
      CHANGELOG.md
  2. 2
      libs/common/src/lib/interfaces/index.ts
  3. 7
      libs/common/src/lib/interfaces/portfolio-summary.interface.ts
  4. 18
      libs/ui/src/lib/fire-calculator/fire-calculator.component.ts

1
CHANGELOG.md

@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Localized the number formatting of the y-axis labels in the line chart component - Localized the number formatting of the y-axis labels in the line chart component
- Improved the wording of the 4% rule in the _FIRE_ section - Improved the wording of the 4% rule in the _FIRE_ section
- Improved the language localization for German (`de`) - Improved the language localization for German (`de`)
- Changed `fireWealth` from a single `number` to a structured interface
## 2.203.0 - 2025-09-27 ## 2.203.0 - 2025-09-27

2
libs/common/src/lib/interfaces/index.ts

@ -19,7 +19,7 @@ import type { EnhancedSymbolProfile } from './enhanced-symbol-profile.interface'
import type { Export } from './export.interface'; import type { Export } from './export.interface';
import type { FilterGroup } from './filter-group.interface'; import type { FilterGroup } from './filter-group.interface';
import type { Filter } from './filter.interface'; import type { Filter } from './filter.interface';
import { FireWealth } from './fire-wealth.interface'; import type { FireWealth } from './fire-wealth.interface';
import type { HistoricalDataItem } from './historical-data-item.interface'; import type { HistoricalDataItem } from './historical-data-item.interface';
import type { HoldingWithParents } from './holding-with-parents.interface'; import type { HoldingWithParents } from './holding-with-parents.interface';
import type { Holding } from './holding.interface'; import type { Holding } from './holding.interface';

7
libs/common/src/lib/interfaces/portfolio-summary.interface.ts

@ -1,3 +1,4 @@
import { FireWealth } from './fire-wealth.interface';
import { PortfolioPerformance } from './portfolio-performance.interface'; import { PortfolioPerformance } from './portfolio-performance.interface';
export interface PortfolioSummary extends PortfolioPerformance { export interface PortfolioSummary extends PortfolioPerformance {
@ -16,11 +17,7 @@ export interface PortfolioSummary extends PortfolioPerformance {
fees: number; fees: number;
filteredValueInBaseCurrency?: number; filteredValueInBaseCurrency?: number;
filteredValueInPercentage?: number; filteredValueInPercentage?: number;
fireWealth: { fireWealth: FireWealth;
today: {
valueInBaseCurrency: number;
};
};
grossPerformance: number; grossPerformance: number;
grossPerformanceWithCurrencyEffect: number; grossPerformanceWithCurrencyEffect: number;
interest: number; interest: number;

18
libs/ui/src/lib/fire-calculator/fire-calculator.component.ts

@ -4,7 +4,6 @@ import {
} from '@ghostfolio/common/chart-helper'; } from '@ghostfolio/common/chart-helper';
import { primaryColorRgb } from '@ghostfolio/common/config'; import { primaryColorRgb } from '@ghostfolio/common/config';
import { getLocale } from '@ghostfolio/common/helper'; import { getLocale } from '@ghostfolio/common/helper';
import { FireWealth } from '@ghostfolio/common/interfaces';
import { ColorScheme } from '@ghostfolio/common/types'; import { ColorScheme } from '@ghostfolio/common/types';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
@ -80,7 +79,7 @@ export class GfFireCalculatorComponent implements OnChanges, OnDestroy {
@Input() colorScheme: ColorScheme; @Input() colorScheme: ColorScheme;
@Input() currency: string; @Input() currency: string;
@Input() deviceType: string; @Input() deviceType: string;
@Input() fireWealth: FireWealth; @Input() fireWealth: number;
@Input() hasPermissionToUpdateUserSettings: boolean; @Input() hasPermissionToUpdateUserSettings: boolean;
@Input() locale = getLocale(); @Input() locale = getLocale();
@Input() projectedTotalAmount: number; @Input() projectedTotalAmount: number;
@ -157,15 +156,12 @@ export class GfFireCalculatorComponent implements OnChanges, OnDestroy {
} }
public ngOnChanges() { public ngOnChanges() {
if ( if (isNumber(this.fireWealth) && this.fireWealth >= 0) {
isNumber(this.fireWealth.today.valueInBaseCurrency) &&
this.fireWealth.today.valueInBaseCurrency >= 0
) {
this.calculatorForm.setValue( this.calculatorForm.setValue(
{ {
annualInterestRate: this.annualInterestRate ?? 5, annualInterestRate: this.annualInterestRate ?? 5,
paymentPerPeriod: this.savingsRate ?? 0, paymentPerPeriod: this.savingsRate ?? 0,
principalInvestmentAmount: this.fireWealth.today.valueInBaseCurrency, principalInvestmentAmount: this.fireWealth,
projectedTotalAmount: this.projectedTotalAmount ?? 0, projectedTotalAmount: this.projectedTotalAmount ?? 0,
retirementDate: this.retirementDate ?? this.DEFAULT_RETIREMENT_DATE retirementDate: this.retirementDate ?? this.DEFAULT_RETIREMENT_DATE
}, },
@ -397,11 +393,9 @@ export class GfFireCalculatorComponent implements OnChanges, OnDestroy {
r r
}); });
datasetDeposit.data.push(this.fireWealth.today.valueInBaseCurrency); datasetDeposit.data.push(this.fireWealth);
datasetInterest.data.push(interest.toNumber()); datasetInterest.data.push(interest.toNumber());
datasetSavings.data.push( datasetSavings.data.push(principal.minus(this.fireWealth).toNumber());
principal.minus(this.fireWealth.today.valueInBaseCurrency)
);
} }
return { return {
@ -411,7 +405,7 @@ export class GfFireCalculatorComponent implements OnChanges, OnDestroy {
} }
private getP() { private getP() {
return this.fireWealth.today.valueInBaseCurrency || 0; return this.fireWealth || 0;
} }
private getPeriodsToRetire(): number { private getPeriodsToRetire(): number {

Loading…
Cancel
Save