Feature/upgrade countries list to version 3.1.0 (#3131)

* Upgrade countries-list to version 3.1.0

* Update changelog
pull/3127/head^2
Thomas Kaul 10 months ago committed by GitHub
parent bb86f85203
commit d32dd5e860
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Extended the content of the _Self-Hosting_ section by available home server systems on the Frequently Asked Questions (FAQ) page
### Changed
- Upgraded `countries-list` from version `2.6.1` to `3.1.0`
### Fixed
- Fixed an issue in the performance calculation caused by multiple `SELL` activities on the same day

@ -5,12 +5,12 @@ import { Sector } from '@ghostfolio/common/interfaces/sector.interface';
import { Injectable } from '@nestjs/common';
import { SymbolProfile } from '@prisma/client';
import { countries } from 'countries-list';
import got from 'got';
@Injectable()
export class TrackinsightDataEnhancerService implements DataEnhancerInterface {
private static baseUrl = 'https://www.trackinsight.com/data-api';
private static countries = require('countries-list/dist/countries.json');
private static countriesMapping = {
'Russian Federation': 'Russia'
};
@ -131,20 +131,19 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface {
(response.countries as unknown as Country[]).length === 0
) {
response.countries = [];
for (const [name, value] of Object.entries<any>(
holdings?.countries ?? {}
)) {
let countryCode: string;
for (const [key, country] of Object.entries<any>(
TrackinsightDataEnhancerService.countries
)) {
for (const [code, country] of Object.entries(countries)) {
if (
country.name === name ||
country.name ===
TrackinsightDataEnhancerService.countriesMapping[name]
) {
countryCode = key;
countryCode = code;
break;
}
}

@ -189,9 +189,8 @@ export class SymbolProfileService {
return {
code,
weight,
continent:
continents[countries[code as string]?.continent] ?? UNKNOWN_KEY,
name: countries[code as string]?.name ?? UNKNOWN_KEY
continent: continents[countries[code]?.continent] ?? UNKNOWN_KEY,
name: countries[code]?.name ?? UNKNOWN_KEY
};
});
}

@ -102,7 +102,7 @@
"class-validator": "0.14.0",
"color": "4.2.3",
"countries-and-timezones": "3.4.1",
"countries-list": "2.6.1",
"countries-list": "3.1.0",
"countup.js": "2.3.2",
"date-fns": "2.29.3",
"envalid": "7.3.1",

@ -9739,10 +9739,10 @@ countries-and-timezones@3.4.1:
resolved "https://registry.yarnpkg.com/countries-and-timezones/-/countries-and-timezones-3.4.1.tgz#0ec2540f57e42f0f740eb2acaede786043347fe1"
integrity sha512-INeHGCony4XUUR8iGL/lmt9s1Oi+n+gFHeJAMfbV5hJfYeDOB8JG1oxz5xFQu5oBZoRCJe/87k1Vzue9DoIauA==
countries-list@2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/countries-list/-/countries-list-2.6.1.tgz#d479757ac873b1e596ccea0a925962d20396c0cb"
integrity sha512-jXM1Nv3U56dPQ1DsUSsEaGmLHburo4fnB7m+1yhWDUVvx5gXCd1ok/y3gXCjXzhqyawG+igcPYcAl4qjkvopaQ==
countries-list@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/countries-list/-/countries-list-3.1.0.tgz#1cbe32f58659c7d6a1e744917689f24c84333ea8"
integrity sha512-HpTBLZba1VPTZSjUnUwR7SykxV7Z/7/+ZM5x5wi5tO99Qvom6bE2SC+AQ18016ujg3jSlYBbMITrHNnPAHSM9Q==
countup.js@2.3.2:
version "2.3.2"

Loading…
Cancel
Save