From 129d89db6736ffe686238509abbe3eb3cbffbbb2 Mon Sep 17 00:00:00 2001 From: DutchmanNL Date: Sun, 5 Apr 2020 21:47:28 +0200 Subject: [PATCH] ### 0.5.4 (2020-04-05) Bugfixes, see changelog for details * (DutchmanNL) Bugfix : Remove test-states * (DutchmanNL) Bugfix : Selected items not shown in tables * (DutchmanNL) Bugfix : Remove incorrect countryInfo state * (Scrounger) Bugfix : Timestamp for continents calculation * (Scrounger) Bugfix : Replace " , " in country name causing errors * (DutchmanNL) Bugfix : Saint Pierre Miquelon (iso2: null, iso3: null) not found in lib! * (DutchmanNL) Implemented Total number of covid-19 tests taken globally. It reflects the Total Tests column in the table at https://www.worldometers.info/coronavirus/. --- README.md | 7 ++++++- io-package.json | 4 ++-- lib/stateAttr.js | 9 +++++++++ main.js | 12 ++---------- package-lock.json | 2 +- package.json | 2 +- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 174f0e2..7f53f29 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,8 @@ The following information is available : | recovered | Amount of totally known recovered cases | | todayCases | New Cases by Today | | todayDeaths | Amount of totally known people died today | +| test | Total number of covid-19 tests taken globally | +| tests per one million counties | Total number of covid-19 tests taken globally per one million | Please be aware this adapter uses as much as possible up-to-date information but there can be an delay of several hours depending on the country's report. German Federal States : https://npgeo-corona-npgeo-de.hub.arcgis.com/ s @@ -87,13 +89,16 @@ As first value the name from the warning message must be taken from the log. The ## Changelog -### 0.5.3 (2020-04-05) Bugfixes, see changelog for details + +### 0.5.4 (2020-04-05) Bugfixes, see changelog for details * (DutchmanNL) Bugfix : Remove test-states * (DutchmanNL) Bugfix : Selected items not shown in tables * (DutchmanNL) Bugfix : Remove incorrect countryInfo state * (Scrounger) Bugfix : Timestamp for continents calculation * (Scrounger) Bugfix : Replace " , " in country name causing errors * (DutchmanNL) Bugfix : Saint Pierre Miquelon (iso2: null, iso3: null) not found in lib! +* (DutchmanNL) Implemented Total number of covid-19 tests taken globally. + It reflects the Total Tests column in the table at https://www.worldometers.info/coronavirus/. ### 0.5.1 (2020-03-31) BugFix : State attribute definition missing for + affectedCountries * (DutchmanNL) BugFix : State attribute definition missing for + affectedCountries diff --git a/io-package.json b/io-package.json index 9955c81..092d584 100644 --- a/io-package.json +++ b/io-package.json @@ -1,9 +1,9 @@ { "common": { "name": "coronavirus-statistics", - "version": "0.5.3", + "version": "0.5.4", "news": { - "0.5.3": { + "0.5.4": { "en": "Bugfixes, see changelog for details", "de": "Bugfixes, siehe Änderungsprotokoll für Details", "ru": "Исправления, см. Список изменений для деталей", diff --git a/lib/stateAttr.js b/lib/stateAttr.js index b1d218c..ae875de 100644 --- a/lib/stateAttr.js +++ b/lib/stateAttr.js @@ -92,6 +92,15 @@ const state_attrb = { name: 'Countries of contient', type: 'string', }, + 'tests' : { + name: 'Total number of covid-19 tests taken globally', + type: 'string', + }, + 'testsPerOneMillion' : { + name: 'Total number of covid-19 tests taken globally by one Million', + type: 'string', + }, + }; module.exports = state_attrb; diff --git a/main.js b/main.js index 8d68cf0..d1262e7 100644 --- a/main.js +++ b/main.js @@ -60,9 +60,7 @@ class Covid19 extends utils.Adapter { this.log.debug(`Data from COVID-19 API received : ${result}`); const values = JSON.parse(result); for (const i of Object.keys(values)) { - if (i !== 'tests' && i !== 'testsPerOneMillion') - - await this.localCreateState(`global_totals.${i}`, i, values[i]); + await this.localCreateState(`global_totals.${i}`, i, values[i]); } } catch (error) { this.log.error(`[loadAll] error: ${error.message}, stack: ${error.stack}`); @@ -113,8 +111,6 @@ class Covid19 extends utils.Adapter { // Don't create a state for the country if (property === 'country') continue; if (property === 'countryInfo') await this.localDeleteState(`${country}.${property}`); - if (property === 'tests') {await this.localDeleteState(`${country}.${property}`); continue;} - if (property === 'testsPerOneMillion') {await this.localDeleteState(`${country}.${property}`); continue;} if (this.config.loadAllCountrys || selectedCountries.includes(rawCountry)) { this.log.debug(`Country add routine : ${property} for : ${country}`); @@ -225,9 +221,7 @@ class Covid19 extends utils.Adapter { country = country.replace(/\./g, ''); this.log.debug(`Country loop rank : ${position} ${JSON.stringify(country)}`); for (const property of Object.keys(dataset)) { - if (property !== 'countryInfo' - && property !== 'tests' - && property !== 'testsPerOneMillion') { + if (property !== 'countryInfo') { await this.localCreateState(`${channelName}.${property}`, property, dataset[property]); } else { // Only take the flag from country info @@ -245,8 +239,6 @@ class Covid19 extends utils.Adapter { if ((continentsStats[c].hasOwnProperty(val) && val !== 'countryInfo' && val !== 'inhabitants' - && val !== 'tests' - && val !== 'testsPerOneMillion' && this.config.getContinents === true)) { if (val !== 'countries' && val !== 'casesPerOneMillion' && val !== 'deathsPerOneMillion') { await this.localCreateState(`global_continents.${c}.${val}`, val, continentsStats[c][val]); diff --git a/package-lock.json b/package-lock.json index 68fc5c7..6119307 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "iobroker.coronavirus-statistics", - "version": "0.5.3", + "version": "0.5.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 51f6a23..08daffb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iobroker.coronavirus-statistics", - "version": "0.5.3", + "version": "0.5.4", "description": "Adapter to show Global Corona Virus information and current reports", "author": { "name": "DutchmanNL",