Skip to content

Commit

Permalink
### 0.5.4 (2020-04-05) Bugfixes, see changelog for details
Browse files Browse the repository at this point in the history
* (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/.
  • Loading branch information
DutchmanNL committed Apr 5, 2020
1 parent 44168a0 commit 129d89d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions io-package.json
Original file line number Diff line number Diff line change
@@ -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": "Исправления, см. Список изменений для деталей",
Expand Down
9 changes: 9 additions & 0 deletions lib/stateAttr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
12 changes: 2 additions & 10 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down Expand Up @@ -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}`);
Expand Down Expand Up @@ -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
Expand All @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 129d89d

Please sign in to comment.