From 965336bf9db8e2dfbab74bb92311a7c2febcc6b1 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sun, 11 Apr 2021 20:08:59 +0200 Subject: [PATCH] Small tweaks to make the log more manageable --- src/platforms/csetforetell-fetch.js | 4 ++-- src/platforms/elicit-fetch.js | 1 + src/platforms/metaculus-fetch.js | 5 +++++ src/utils/mongo-wrapper.js | 9 +++++---- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/platforms/csetforetell-fetch.js b/src/platforms/csetforetell-fetch.js index e1f6c80..c3dd3c7 100644 --- a/src/platforms/csetforetell-fetch.js +++ b/src/platforms/csetforetell-fetch.js @@ -141,7 +141,7 @@ async function csetforetell_inner(cookie){ "platform": "CSET-foretell", ...moreinfo }) - if(i % 10 == 0){ + if(i % 30 == 0){ console.log(`Page #${i}`) console.log(question) } @@ -164,7 +164,7 @@ async function csetforetell_inner(cookie){ } // let string = JSON.stringify(results,null, 2) // fs.writeFileSync('./data/csetforetell-questions.json', string); - console.log(results) + // console.log(results) await upsert(results, "csetforetell-questions") diff --git a/src/platforms/elicit-fetch.js b/src/platforms/elicit-fetch.js index 47de414..855f47a 100644 --- a/src/platforms/elicit-fetch.js +++ b/src/platforms/elicit-fetch.js @@ -119,5 +119,6 @@ export async function elicit() { await processArray(results.data) } }); + await sleep(5000) // needed to wait for Papaparse's callback to be executed. } //elicit() diff --git a/src/platforms/metaculus-fetch.js b/src/platforms/metaculus-fetch.js index 0ff0dd2..79b0339 100644 --- a/src/platforms/metaculus-fetch.js +++ b/src/platforms/metaculus-fetch.js @@ -72,6 +72,7 @@ export async function metaculus() { console.log(`Query #${i}`) let metaculusQuestions = await fetchMetaculusQuestions(next) let results = metaculusQuestions.results; + let j=false for (let result of results) { if ( (result.publish_time < now) && @@ -128,6 +129,10 @@ export async function metaculus() { if (Number(result.number_of_predictions) >= 10) { // console.log(interestingInfo) all_questions.push(interestingInfo) + if(!j && (i %% 20 == 0)){ + console.log(interestingInfo) + j = true + } } } diff --git a/src/utils/mongo-wrapper.js b/src/utils/mongo-wrapper.js index 95dcfcf..7744e63 100644 --- a/src/utils/mongo-wrapper.js +++ b/src/utils/mongo-wrapper.js @@ -32,7 +32,8 @@ export async function upsert (contents, documentName, collectionName="metaforeca const myDocument = await collection.findOne(filter); // Print to the console - console.log(myDocument.contentsArray.slice(0,3)); + console.log(myDocument.contentsArray.slice(0,1 + )); } catch (err) { console.log(err.stack); } @@ -75,7 +76,7 @@ export async function mongoRead (documentName, collectionName="metaforecastColle finally { await client.close(); } - console.log(documentContents.slice(0,10)); + console.log(documentContents.slice(0,1)); return documentContents } @@ -113,6 +114,6 @@ export async function mongoReadWithReadCredentials (documentName, collectionName finally { await client.close(); } - // console.log(documentContents.slice(0,10)); + // console.log(documentContents.slice(0,1)); return documentContents -} \ No newline at end of file +}