From f45e302208991b8dade5d67245ff966d47cc5208 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Thu, 29 Apr 2021 12:42:34 +0200 Subject: [PATCH] Stopped adding to history as MongoDB total size was exceeded --- src/utils/doEverything.js | 6 ++++-- src/utils/mergeEverything.js | 2 +- src/utils/stars.js | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/utils/doEverything.js b/src/utils/doEverything.js index 716dcb8..b88d1c6 100644 --- a/src/utils/doEverything.js +++ b/src/utils/doEverything.js @@ -1,3 +1,5 @@ +import {astralcodexten} from "../platforms/astralcodexten-fetch.js" +import {coupcast} from "../platforms/coupcast-fetch.js" import {csetforetell} from "../platforms/csetforetell-fetch.js" import {elicit} from "../platforms/elicit-fetch.js" import {estimize} from "../platforms/estimize-fetch.js" @@ -34,7 +36,7 @@ export async function tryCatchTryAgain (fun) { } } export async function doEverything(){ - let functions = [csetforetell, elicit, /* estimize, */ fantasyscotus, foretold, goodjudgment, goodjudgmentopen, hypermind, ladbrokes, metaculus, polymarket, predictit, omen, smarkets, williamhill, mergeEverything, addToHistory, rebuildNetlifySiteWithNewData] + let functions = [coupcast, csetforetell, elicit, /* estimize, */ fantasyscotus, foretold, goodjudgment, goodjudgmentopen, hypermind, ladbrokes, metaculus, polymarket, predictit, omen, smarkets, williamhill, mergeEverything, /*addToHistory,*/ rebuildNetlifySiteWithNewData] console.log("") console.log("") @@ -57,4 +59,4 @@ export async function doEverything(){ await tryCatchTryAgain(fun) console.log("****************************") } -} \ No newline at end of file +} diff --git a/src/utils/mergeEverything.js b/src/utils/mergeEverything.js index dbb5b17..38ef7dd 100644 --- a/src/utils/mergeEverything.js +++ b/src/utils/mergeEverything.js @@ -1,7 +1,7 @@ import { mongoRead, upsert } from "./mongo-wrapper.js" /* Merge everything */ -let sets = ["csetforetell", "elicit", "estimize", "fantasyscotus", "foretold", "givewellopenphil", "goodjudgment","goodjudmentopen", "hypermind", "ladbrokes", "metaculus", "polymarket", "predictit", "omen", "smarkets", "williamhill", "xrisk"] +let sets = ["astralcodexten","coupcast", "csetforetell", "elicit", "estimize", "fantasyscotus", "foretold", "givewellopenphil", "goodjudgment","goodjudmentopen", "hypermind", "ladbrokes", "metaculus", "polymarket", "predictit", "omen", "smarkets", "williamhill", "xrisk"] let suffix = "-questions" export async function mergeEverything(){ diff --git a/src/utils/stars.js b/src/utils/stars.js index 78803ee..34dba03 100644 --- a/src/utils/stars.js +++ b/src/utils/stars.js @@ -27,6 +27,22 @@ export function getStarSymbols(numstars) { let average = array => array.reduce((a, b) => a + b, 0) / (array.length) +function calculateStarsAstralCodexTen(data) { + let nuno = data => 3 + let eli = (data) => null + let misha = (data) => null + let starsDecimal = average([nuno(data)]) //, eli(data), misha(data)]) + let starsInteger = Math.round(starsDecimal) + return starsInteger +} + +function calculateStarsCoupCast(data) { + let nuno = (data) => 3 + let starsDecimal = average([nuno(data)]) //, eli(data), misha(data)]) + let starsInteger = Math.round(starsDecimal) + return starsInteger +} + function calculateStarsCSETForetell(data) { let nuno = (data) => data.numforecasts > 100 ? 3 : 2 let eli = (data) => 3 @@ -172,6 +188,12 @@ function calculateStarsWilliamHill(data) { export function calculateStars(platform, data) { let stars = 2; switch (platform) { + case "AstralCodexTen": + stars = calculateStarsAstralCodexTen(data) + break; + case "CoupCast": + stars = calculateStarsCoupCast(data) + break; case "CSET-foretell": stars = calculateStarsCSETForetell(data) break;