fix: Do not update database if signed out

This commit is contained in:
NunoSempere 2021-07-09 18:38:24 +02:00
parent d9390faeec
commit 4247af47c6
2 changed files with 13 additions and 4 deletions

View File

@ -108,8 +108,8 @@ async function fetchStats(questionUrl, cookie){
let description = descriptionprocessed8 let description = descriptionprocessed8
// Number of forecasts // Number of forecasts
console.log(response) //console.log(response)
console.log(response.split("prediction_sets_count":")[1]) //console.log(response.split("prediction_sets_count":")[1])
let numforecasts = response.split("prediction_sets_count":")[1].split(",")[0] let numforecasts = response.split("prediction_sets_count":")[1].split(",")[0]
// console.log(numforecasts) // console.log(numforecasts)
@ -224,7 +224,11 @@ async function csetforetell_inner(cookie){
// let string = JSON.stringify(results,null, 2) // let string = JSON.stringify(results,null, 2)
// fs.writeFileSync('./data/csetforetell-questions.json', string); // fs.writeFileSync('./data/csetforetell-questions.json', string);
// console.log(results) // console.log(results)
await upsert(results, "csetforetell-questions") if(results.length > 0){
await upsert(results, "csetforetell-questions")
}else{
console.log("Not updating results, as process was not signed in")
}
let end = Date.now() let end = Date.now()
let difference = end-init let difference = end-init

View File

@ -188,7 +188,12 @@ async function goodjudgmentopen_inner(cookie) {
} }
// let string = JSON.stringify(results, null, 2) // let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('./data/goodjudmentopen-questions.json', string); // fs.writeFileSync('./data/goodjudmentopen-questions.json', string);
await upsert(results, "goodjudmentopen-questions")
if(results.length > 0){
await upsert(results, "goodjudmentopen-questions")
}else{
console.log("Not updating results, as process was not signed in")
}
let end = Date.now() let end = Date.now()
let difference = end - init let difference = end - init