Stopped adding to history as MongoDB total size was exceeded

This commit is contained in:
NunoSempere 2021-04-29 12:42:34 +02:00
parent 3d406ac919
commit f45e302208
3 changed files with 27 additions and 3 deletions

View File

@ -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 {csetforetell} from "../platforms/csetforetell-fetch.js"
import {elicit} from "../platforms/elicit-fetch.js" import {elicit} from "../platforms/elicit-fetch.js"
import {estimize} from "../platforms/estimize-fetch.js" import {estimize} from "../platforms/estimize-fetch.js"
@ -34,7 +36,7 @@ export async function tryCatchTryAgain (fun) {
} }
} }
export async function doEverything(){ 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("")
console.log("") console.log("")
@ -57,4 +59,4 @@ export async function doEverything(){
await tryCatchTryAgain(fun) await tryCatchTryAgain(fun)
console.log("****************************") console.log("****************************")
} }
} }

View File

@ -1,7 +1,7 @@
import { mongoRead, upsert } from "./mongo-wrapper.js" import { mongoRead, upsert } from "./mongo-wrapper.js"
/* Merge everything */ /* 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" let suffix = "-questions"
export async function mergeEverything(){ export async function mergeEverything(){

View File

@ -27,6 +27,22 @@ export function getStarSymbols(numstars) {
let average = array => array.reduce((a, b) => a + b, 0) / (array.length) 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) { function calculateStarsCSETForetell(data) {
let nuno = (data) => data.numforecasts > 100 ? 3 : 2 let nuno = (data) => data.numforecasts > 100 ? 3 : 2
let eli = (data) => 3 let eli = (data) => 3
@ -172,6 +188,12 @@ function calculateStarsWilliamHill(data) {
export function calculateStars(platform, data) { export function calculateStars(platform, data) {
let stars = 2; let stars = 2;
switch (platform) { switch (platform) {
case "AstralCodexTen":
stars = calculateStarsAstralCodexTen(data)
break;
case "CoupCast":
stars = calculateStarsCoupCast(data)
break;
case "CSET-foretell": case "CSET-foretell":
stars = calculateStarsCSETForetell(data) stars = calculateStarsCSETForetell(data)
break; break;