Skip to content

Commit

Permalink
wip: Atualizar para 19 de novembro de 2020
Browse files Browse the repository at this point in the history
  • Loading branch information
emilianoeloi committed Nov 21, 2020
1 parent c442689 commit 0fd954f
Show file tree
Hide file tree
Showing 13 changed files with 3,421 additions and 3,433 deletions.
2 changes: 1 addition & 1 deletion BD/COVID-19
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Eu tive um derrame cerebral (AVE-He) que comprometeu uma parte do meu cérebro o

## Gráfico

![confirmados](confirmados_2020-10-27_France_Germany.png)
![confirmados](images/confirmados_2020-11-19_US_France_Italy.png)

Confirmados pelo COVID-19 pelo período x confirmados.

Expand All @@ -23,6 +23,22 @@ Confirmados pelo COVID-19 pelo período x confirmados.

## Configurações

0. Dados pra testar

```javascript
/// loadTest.js

const loadTest = new Load(
[
us,
france,
italy
],
new Date("2020-05-01T00:00:00.000"),
new Date("2020-11-19T23:59:59.999")
)
```

1. Instalar o projeto
```shell
# make install
Expand Down
File renamed without changes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions integrate/__tests__/getCSVReportFiles.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@ const getCSVReportFiles = require('../getCSVReportFiles.js')
const Country = require('../Country.js');

describe('Obeter os relatórios de confirmados', () => {
const defaultPath = "./312"
const start = new Date("2020-01-22T00:00:00.000")
const finish = new Date("2020-01-23T23:59:59.999")
const defaultPath = "./__mocks__"
const start = new Date("2020-07-03T00:00:00.000")
const finish = new Date("2020-07-04T23:59:59.999")
const countryGroup = [
new Country("peru", "Peru", "#000"),
new Country("brazil", "Brazil", "#111")
]

test('Testando os dados do Brazil', done => {
test('Testando os dados do Brazil', () => {
getCSVReportFiles(
defaultPath,
start,
finish,
countryGroup
)
expect(b[1].name).toBe('Brazil')
done()
})
})
19 changes: 13 additions & 6 deletions integrate/getCSVReportFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {
saveCountriesDataPromise
} = require('./saveCountriesData.js')
const {
whiteFilePromise
writeFilePromise
} = require('./writeFile.js')

const getCSVReportFiles = function(
Expand All @@ -28,21 +28,28 @@ const getCSVReportFiles = function(

readPromise(fileCSV, countryGroup)
.then((data) => {
console.info("readPromise ✨")
return setStorageCountriesPromise(data)
})
.catch((err) => {
console.info("readPromise 🚨", err)
})

.then((data) => {
console.info("setStorageCountriesPromise ✨")
return saveCountriesDataPromise(data)
})
.catch((err) => {
console.info("saveCountriesDataPromise 🚨", err)
})

.then((data) => {
console.info("whiteFile ✨")
return whiteFilePromise(data)
return writeFilePromise(data)
})
.catch((err) => {
console.info("readPromise, setStorageCountriesPromise, whiteFile, whiteFile 🚨", err)
console.info("whiteFile, whiteFile 🚨", err)
})

.finally((err) => { })

// readFileCB(fileCSV, countryGroup, saveCountriesData, writeFileCB)

var newDate = loop.setDate(loop.getDate() + 1);
Expand Down
8 changes: 5 additions & 3 deletions integrate/loadTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ const us = new Country("us", "US", "#3C3B6E")

const loadTest = new Load(
[
brazil
us,
france,
italy
],
new Date("2020-07-03T00:00:00.000"),
new Date("2020-07-04T23:59:59.999")
new Date("2020-05-01T00:00:00.000"),
new Date("2020-11-19T23:59:59.999")
)

module.exports = loadTest;
1 change: 0 additions & 1 deletion integrate/readFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ var read = function(csvFile, countryGroup, saveCountriesDataCB, writeFileCB) {
}

module.exports = {
read,
readPromise,
getFileName,
getFileDate,
Expand Down
11 changes: 0 additions & 11 deletions integrate/saveCountriesData.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@ const dbCovid19 = function(countryFile, cases) {
process.env.GLOBAL_COVID_19 = JSON.stringify(globalCovid19)
}

function saveCountriesData(countriesData, writeFileCB) {
const constries = Object.values(countriesData);
constries.forEach(function(value, key) {
var countryFile = Object.keys(countriesData)[key];
dbCovid19(countryFile, value)
})
process.env.COUNT = parseInt(process.env.COUNT) - 1
writeFileCB()
}

function saveCountriesDataPromise(countriesData) {
return new Promise((resolve, reject) => {
try {
Expand All @@ -46,6 +36,5 @@ function saveCountriesDataPromise(countriesData) {
}

module.exports = {
saveCountriesData,
saveCountriesDataPromise
}
8 changes: 0 additions & 8 deletions integrate/writeFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ const writeIntegrateFile = function(countries) {
})
}

const writeFile = function() {
if (parseInt(process.env.COUNT) == 0) {
const countriesData = JSON.parse(process.env.GLOBAL_COVID_19)
writeCountryFile(countriesData);
}
}

const writeFilePromise = function() {
return new Promise((resolve, reject) => {
try {
Expand All @@ -66,7 +59,6 @@ const writeFilePromise = function() {
}

module.exports = {
writeFile,
writeFilePromise,
writeIntegrateFile,
writeCountryFilePromise
Expand Down

0 comments on commit 0fd954f

Please sign in to comment.