Merge branch 'main' of github.com:ghostfolio/ghostfolio
All checks were successful
Docker image CD / build_and_push (push) Successful in 35m10s
All checks were successful
Docker image CD / build_and_push (push) Successful in 35m10s
This commit is contained in:
commit
86a05c0636
@ -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/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed the functionality to delete an asset profile of a custom currency in the admin control panel
|
||||
|
||||
## 2.143.0 - 2025-03-02
|
||||
|
||||
### Added
|
||||
|
@ -109,8 +109,27 @@ export class AdminService {
|
||||
symbol
|
||||
}: AssetProfileIdentifier) {
|
||||
await this.marketDataService.deleteMany({ dataSource, symbol });
|
||||
|
||||
const currency = getCurrencyFromSymbol(symbol);
|
||||
const customCurrencies = (await this.propertyService.getByKey(
|
||||
PROPERTY_CURRENCIES
|
||||
)) as string[];
|
||||
|
||||
if (customCurrencies.includes(currency)) {
|
||||
const updatedCustomCurrencies = customCurrencies.filter(
|
||||
(customCurrency) => {
|
||||
return customCurrency !== currency;
|
||||
}
|
||||
);
|
||||
|
||||
await this.putSetting(
|
||||
PROPERTY_CURRENCIES,
|
||||
JSON.stringify(updatedCustomCurrencies)
|
||||
);
|
||||
} else {
|
||||
await this.symbolProfileService.delete({ dataSource, symbol });
|
||||
}
|
||||
}
|
||||
|
||||
public async get(): Promise<AdminData> {
|
||||
const exchangeRates = this.exchangeRateDataService
|
||||
|
@ -4,7 +4,8 @@ import { AdminService } from '@ghostfolio/client/services/admin.service';
|
||||
import { ghostfolioScraperApiSymbolPrefix } from '@ghostfolio/common/config';
|
||||
import {
|
||||
getCurrencyFromSymbol,
|
||||
isDerivedCurrency
|
||||
isDerivedCurrency,
|
||||
isRootCurrency
|
||||
} from '@ghostfolio/common/helper';
|
||||
import {
|
||||
AssetProfileIdentifier,
|
||||
@ -77,6 +78,7 @@ export class AdminMarketDataService {
|
||||
activitiesCount === 0 &&
|
||||
!isBenchmark &&
|
||||
!isDerivedCurrency(getCurrencyFromSymbol(symbol)) &&
|
||||
!isRootCurrency(getCurrencyFromSymbol(symbol)) &&
|
||||
!symbol.startsWith(ghostfolioScraperApiSymbolPrefix)
|
||||
);
|
||||
}
|
||||
|
@ -354,6 +354,16 @@ export function isDerivedCurrency(aCurrency: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export function isRootCurrency(aCurrency: string) {
|
||||
if (aCurrency === 'USD') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return DERIVED_CURRENCIES.find(({ rootCurrency }) => {
|
||||
return rootCurrency === aCurrency;
|
||||
});
|
||||
}
|
||||
|
||||
export function parseDate(date: string): Date {
|
||||
if (!date) {
|
||||
return undefined;
|
||||
|
Loading…
x
Reference in New Issue
Block a user