Feature/upgrade countries list to version 3.1.0 (#3131)
* Upgrade countries-list to version 3.1.0 * Update changelog
This commit is contained in:
parent
bb86f85203
commit
d32dd5e860
@ -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
|
- 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
|
||||||
|
|
||||||
- Fixed an issue in the performance calculation caused by multiple `SELL` activities on the same day
|
- 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 { Injectable } from '@nestjs/common';
|
||||||
import { SymbolProfile } from '@prisma/client';
|
import { SymbolProfile } from '@prisma/client';
|
||||||
|
import { countries } from 'countries-list';
|
||||||
import got from 'got';
|
import got from 'got';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class TrackinsightDataEnhancerService implements DataEnhancerInterface {
|
export class TrackinsightDataEnhancerService implements DataEnhancerInterface {
|
||||||
private static baseUrl = 'https://www.trackinsight.com/data-api';
|
private static baseUrl = 'https://www.trackinsight.com/data-api';
|
||||||
private static countries = require('countries-list/dist/countries.json');
|
|
||||||
private static countriesMapping = {
|
private static countriesMapping = {
|
||||||
'Russian Federation': 'Russia'
|
'Russian Federation': 'Russia'
|
||||||
};
|
};
|
||||||
@ -131,20 +131,19 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface {
|
|||||||
(response.countries as unknown as Country[]).length === 0
|
(response.countries as unknown as Country[]).length === 0
|
||||||
) {
|
) {
|
||||||
response.countries = [];
|
response.countries = [];
|
||||||
|
|
||||||
for (const [name, value] of Object.entries<any>(
|
for (const [name, value] of Object.entries<any>(
|
||||||
holdings?.countries ?? {}
|
holdings?.countries ?? {}
|
||||||
)) {
|
)) {
|
||||||
let countryCode: string;
|
let countryCode: string;
|
||||||
|
|
||||||
for (const [key, country] of Object.entries<any>(
|
for (const [code, country] of Object.entries(countries)) {
|
||||||
TrackinsightDataEnhancerService.countries
|
|
||||||
)) {
|
|
||||||
if (
|
if (
|
||||||
country.name === name ||
|
country.name === name ||
|
||||||
country.name ===
|
country.name ===
|
||||||
TrackinsightDataEnhancerService.countriesMapping[name]
|
TrackinsightDataEnhancerService.countriesMapping[name]
|
||||||
) {
|
) {
|
||||||
countryCode = key;
|
countryCode = code;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,9 +189,8 @@ export class SymbolProfileService {
|
|||||||
return {
|
return {
|
||||||
code,
|
code,
|
||||||
weight,
|
weight,
|
||||||
continent:
|
continent: continents[countries[code]?.continent] ?? UNKNOWN_KEY,
|
||||||
continents[countries[code as string]?.continent] ?? UNKNOWN_KEY,
|
name: countries[code]?.name ?? UNKNOWN_KEY
|
||||||
name: countries[code as string]?.name ?? UNKNOWN_KEY
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@
|
|||||||
"class-validator": "0.14.0",
|
"class-validator": "0.14.0",
|
||||||
"color": "4.2.3",
|
"color": "4.2.3",
|
||||||
"countries-and-timezones": "3.4.1",
|
"countries-and-timezones": "3.4.1",
|
||||||
"countries-list": "2.6.1",
|
"countries-list": "3.1.0",
|
||||||
"countup.js": "2.3.2",
|
"countup.js": "2.3.2",
|
||||||
"date-fns": "2.29.3",
|
"date-fns": "2.29.3",
|
||||||
"envalid": "7.3.1",
|
"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"
|
resolved "https://registry.yarnpkg.com/countries-and-timezones/-/countries-and-timezones-3.4.1.tgz#0ec2540f57e42f0f740eb2acaede786043347fe1"
|
||||||
integrity sha512-INeHGCony4XUUR8iGL/lmt9s1Oi+n+gFHeJAMfbV5hJfYeDOB8JG1oxz5xFQu5oBZoRCJe/87k1Vzue9DoIauA==
|
integrity sha512-INeHGCony4XUUR8iGL/lmt9s1Oi+n+gFHeJAMfbV5hJfYeDOB8JG1oxz5xFQu5oBZoRCJe/87k1Vzue9DoIauA==
|
||||||
|
|
||||||
countries-list@2.6.1:
|
countries-list@3.1.0:
|
||||||
version "2.6.1"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/countries-list/-/countries-list-2.6.1.tgz#d479757ac873b1e596ccea0a925962d20396c0cb"
|
resolved "https://registry.yarnpkg.com/countries-list/-/countries-list-3.1.0.tgz#1cbe32f58659c7d6a1e744917689f24c84333ea8"
|
||||||
integrity sha512-jXM1Nv3U56dPQ1DsUSsEaGmLHburo4fnB7m+1yhWDUVvx5gXCd1ok/y3gXCjXzhqyawG+igcPYcAl4qjkvopaQ==
|
integrity sha512-HpTBLZba1VPTZSjUnUwR7SykxV7Z/7/+ZM5x5wi5tO99Qvom6bE2SC+AQ18016ujg3jSlYBbMITrHNnPAHSM9Q==
|
||||||
|
|
||||||
countup.js@2.3.2:
|
countup.js@2.3.2:
|
||||||
version "2.3.2"
|
version "2.3.2"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user