Merge branch 'main' of github.com:ghostfolio/ghostfolio
All checks were successful
Docker image CD / build_and_push (push) Successful in 35m10s

This commit is contained in:
sudacode 2025-03-05 12:00:52 -08:00
commit 86a05c0636
4 changed files with 39 additions and 2 deletions

View File

@ -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

View File

@ -109,7 +109,26 @@ export class AdminService {
symbol
}: AssetProfileIdentifier) {
await this.marketDataService.deleteMany({ dataSource, symbol });
await this.symbolProfileService.delete({ 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> {

View File

@ -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)
);
}

View File

@ -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;