Browse Source

bug issue created

pull/4779/head
tobikugel 4 months ago
committed by Thomas Kaul
parent
commit
372fb21720
  1. 4
      apps/api/src/models/rule.ts
  2. 25
      apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts
  3. 4
      apps/client/src/app/pages/i18n/i18n-page.html

4
apps/api/src/models/rule.ts

@ -1,5 +1,6 @@
import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface';
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service';
import { I18nService } from '@ghostfolio/api/services/i18n/i18n.service';
import { groupBy } from '@ghostfolio/common/helper'; import { groupBy } from '@ghostfolio/common/helper';
import { import {
PortfolioPosition, PortfolioPosition,
@ -13,6 +14,7 @@ import { EvaluationResult } from './interfaces/evaluation-result.interface';
import { RuleInterface } from './interfaces/rule.interface'; import { RuleInterface } from './interfaces/rule.interface';
export abstract class Rule<T extends RuleSettings> implements RuleInterface<T> { export abstract class Rule<T extends RuleSettings> implements RuleInterface<T> {
protected i18nService = new I18nService();
private key: string; private key: string;
private name: string; private name: string;
@ -56,7 +58,7 @@ export abstract class Rule<T extends RuleSettings> implements RuleInterface<T> {
previousValue + previousValue +
this.exchangeRateDataService.toCurrency( this.exchangeRateDataService.toCurrency(
new Big(currentValue.quantity) new Big(currentValue.quantity)
.mul(currentValue.marketPrice) .mul(currentValue.marketPrice ?? 0)
.toNumber(), .toNumber(),
currentValue.currency, currentValue.currency,
baseCurrency baseCurrency

25
apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts

@ -1,6 +1,7 @@
import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface';
import { Rule } from '@ghostfolio/api/models/rule'; import { Rule } from '@ghostfolio/api/models/rule';
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service';
import { DEFAULT_LANGUAGE_CODE } from '@ghostfolio/common/config';
import { UserSettings } from '@ghostfolio/common/interfaces'; import { UserSettings } from '@ghostfolio/common/interfaces';
export class FeeRatioInitialInvestment extends Rule<Settings> { export class FeeRatioInitialInvestment extends Rule<Settings> {
@ -27,18 +28,30 @@ export class FeeRatioInitialInvestment extends Rule<Settings> {
: 0; : 0;
if (feeRatio > ruleSettings.thresholdMax) { if (feeRatio > ruleSettings.thresholdMax) {
const evaluation = this.i18nService
.getTranslation({
id: 'rule.fee-ratio-initial-investment.exceed',
languageCode: DEFAULT_LANGUAGE_CODE
})
.replace('{thresholdMax}', (ruleSettings.thresholdMax * 100).toFixed(2))
.replace('{feeRatio}', (feeRatio * 100).toPrecision(3));
return { return {
evaluation: `The fees do exceed ${ evaluation,
ruleSettings.thresholdMax * 100
}% of your initial investment (${(feeRatio * 100).toPrecision(3)}%)`,
value: false value: false
}; };
} }
const evaluation = this.i18nService
.getTranslation({
id: 'rule.fee-ratio-initial-investment.not-exceed',
languageCode: DEFAULT_LANGUAGE_CODE
})
.replace('{thresholdMax}', (ruleSettings.thresholdMax * 100).toFixed(2))
.replace('{feeRatio}', (feeRatio * 100).toPrecision(3));
return { return {
evaluation: `The fees do not exceed ${ evaluation,
ruleSettings.thresholdMax * 100
}% of your initial investment (${(feeRatio * 100).toPrecision(3)}%)`,
value: true value: true
}; };
} }

4
apps/client/src/app/pages/i18n/i18n-page.html

@ -11,6 +11,10 @@
performance, portfolio, software, stock, trading, wealth, web3 performance, portfolio, software, stock, trading, wealth, web3
</li> </li>
<li i18n="@@myAccount">My Account</li> <li i18n="@@myAccount">My Account</li>
<!--
<li i18n="@@rule.fee-ratio-initial-investment.exceed">The fees do exceed {{thresholdMax}}% of your initial investment ({feeRatio}%)</li>
<li i18n="@@rule.fee-ratio-initial-investment.not-exceed">The fees do exceed {thresholdMax}% of your initial investment ({feeRatio}%)</li>
-->
<li i18n="@@slogan">Open Source Wealth Management Software</li> <li i18n="@@slogan">Open Source Wealth Management Software</li>
</ul> </ul>
</div> </div>

Loading…
Cancel
Save