From aeece457563d5155f75a7d3710a9f4d2ca1e96ff Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sun, 9 Oct 2022 12:30:24 +0100 Subject: [PATCH] Revert "feat: save Insight Prediction progress" This reverts commit 3892db1157c3be0d400f238485211522ee950b4d. It should make graphql fixing easier --- src/backend/platforms/insight.ts | 33 +++++++++++-------- .../QuestionCard/QuestionFooter.tsx | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/backend/platforms/insight.ts b/src/backend/platforms/insight.ts index f942afb..ee5886b 100644 --- a/src/backend/platforms/insight.ts +++ b/src/backend/platforms/insight.ts @@ -65,7 +65,7 @@ async function fetchData(bearer: string) { console.log(`Page = #${pageNum}`); // console.log(newPageData) - // console.dir(finalObject, {depth: null}); + console.dir(finalObject, {depth: null}); results.push(... finalObject); let newPagination = newPage.meta.pagination; @@ -79,30 +79,35 @@ async function fetchData(bearer: string) { } async function processPredictions(predictions: any[]) { - let filteredPredictions = predictions.filter(prediction => !prediction.is_resolved && prediction.category != "Sports") - let results = filteredPredictions.map((prediction) => { + let results = await predictions.map((prediction) => { const id = `${platformName}-${ prediction.id }`; - const options: FetchedQuestion["options"] = prediction.options + const probability = prediction.probability; + const options: FetchedQuestion["options"] = [ + { + name: "Yes", + probability: probability, + type: "PROBABILITY" + }, { + name: "No", + probability: 1 - probability, + type: "PROBABILITY" + }, + ]; const result: FetchedQuestion = { id, title: prediction.title, - url: `https:${ - prediction.url - }`, - description: prediction.rules, + url: "https://example.com", + description: prediction.description, options, qualityindicators: { - volume: prediction.volume, - createdTime: prediction.created_at // other: prediction.otherx, // indicators: prediction.indicatorx, } }; return result; }); - // Filter results return results; // resultsProcessed } @@ -112,12 +117,12 @@ export const insight: Platform = { name: platformName, label: "Insight Prediction", color: "#ff0000", - version: "v1", + version: "v0", async fetcher() { let bearer = process.env.INSIGHT_BEARER; let data = await fetchData(bearer); - let results = await processPredictions(data); - console.log(results); + // console.log(data); + let results = []; // await processPredictions(data); // somehow needed return results; }, calculateStars(data) { diff --git a/src/web/questions/components/QuestionCard/QuestionFooter.tsx b/src/web/questions/components/QuestionCard/QuestionFooter.tsx index 837be7c..e60badb 100644 --- a/src/web/questions/components/QuestionCard/QuestionFooter.tsx +++ b/src/web/questions/components/QuestionCard/QuestionFooter.tsx @@ -74,7 +74,7 @@ const getCurrencySymbolIfNeeded = ({ "openInterest", "liquidity", ]; - let dollarPlatforms = ["predictit", "kalshi", "polymarket", "insight"]; + let dollarPlatforms = ["predictit", "kalshi", "polymarket"]; if (indicatorsWhichNeedCurrencySymbol.includes(indicator)) { if (dollarPlatforms.includes(platform)) { return "$";