From 5b92f73747609844742e5f01d533268babd0920c Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sun, 27 Jun 2021 19:43:58 +0200 Subject: [PATCH] Rootclaim formatting tweak --- src/platforms/rootclaim-fetch.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/platforms/rootclaim-fetch.js b/src/platforms/rootclaim-fetch.js index 2730a3a..4bfce99 100644 --- a/src/platforms/rootclaim-fetch.js +++ b/src/platforms/rootclaim-fetch.js @@ -32,19 +32,20 @@ async function fetchAndProcessData() { let results = [] for (let claim of claims) { let options = [] - for (let scenario in claim.scenarios) { + for (let scenario of claim.scenarios) { + //console.log(scenario) options.push({ - "name": scenario.name, + "name": toMarkdown(scenario.text).replace("\n","").replace("'","'"), "probability": scenario.net_prob / 100, "type": "PROBABILITY" }) } let claimUrlPath = claim.created_at < "2020" ? "claim" : "analysis" let obj = ({ - "title": claim.question, + "title": toMarkdown(claim.question).replace("\n",""), "url": `https://www.rootclaim.com/${claimUrlPath}/${claim.slug}`, "platform": "Rootclaim", - "description": toMarkdown(claim.background), + "description": toMarkdown(claim.background).replace("'","'"), "options": options, "timestamp": new Date().toISOString(), "qualityindicators": { @@ -60,7 +61,7 @@ async function fetchAndProcessData() { /* Body */ export async function rootclaim() { let results = await fetchAndProcessData() - // console.log(results) + //console.log(JSON.stringify(results, null, 4)) // let string = JSON.stringify(results, null, 2) // fs.writeFileSync('rootclaim-questions.json', string); await upsert(results, "rootclaim-questions")