Commit baf7dbe3 authored by Michał Woźniak's avatar Michał Woźniak
Browse files

China fix complete; also, data gap filling works, and has a failsafe

parent a4bfdb29
Pipeline #111 passed with stage
in 1 second
......@@ -120,7 +120,6 @@ let getSiteCases = (site) => {
} else {
cases = 1 * row[8].replace(/[^0-9]/g, '')
}
console.log(row)
return {
date: row[0],
cases: cases
......@@ -129,12 +128,17 @@ let getSiteCases = (site) => {
}
// we need to fill the gaps in places
/*console.log(data)
var gaps_filled = [data[0]]
var cur_date = new Date(data[0].date)
var cur_index = 1 // starting from one, yes
while (cur_index < data.length) {
// failsafe in case this is a runaway loop
var failsafe = 500
// go through the data and fill in the blanks
while ( (cur_index < data.length) && (failsafe > 0) ) {
// decrement the failsafe
failsafe -= 1
// increment the date
cur_date.setDate(cur_date.getDate() + 1)
// check if it matches
......@@ -148,9 +152,12 @@ let getSiteCases = (site) => {
cases: data[cur_index-1].cases
})
}
}*/
gaps_filled = data
console.log(data)
}
if (failsafe === 0) {
console.log('ERROR: data gaps filling loop was killed! using unfixed data!')
gaps_filled = data
}
return {
data: gaps_filled,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment