diff --git a/src/backend/platforms/metaculus/api.ts b/src/backend/platforms/metaculus/api.ts index e12de17..ad950e5 100644 --- a/src/backend/platforms/metaculus/api.ts +++ b/src/backend/platforms/metaculus/api.ts @@ -49,7 +49,8 @@ const predictableProps = { community_prediction: { properties: { full: { - properties: { + // q1/q2/q3 can be missing, e.g. https://www.metaculus.com/api2/questions/1633/ + optionalProperties: { q1: { type: "float64", }, diff --git a/src/backend/platforms/metaculus/index.ts b/src/backend/platforms/metaculus/index.ts index ff943b3..526fca6 100644 --- a/src/backend/platforms/metaculus/index.ts +++ b/src/backend/platforms/metaculus/index.ts @@ -38,19 +38,21 @@ async function apiQuestionToFetchedQuestions( const isBinary = q.possibilities.type === "binary"; let options: FetchedQuestion["options"] = []; if (isBinary) { - const probability = Number(q.community_prediction.full.q2); - options = [ - { - name: "Yes", - probability: probability, - type: "PROBABILITY", - }, - { - name: "No", - probability: 1 - probability, - type: "PROBABILITY", - }, - ]; + const probability = q.community_prediction.full.q2; + if (probability !== undefined) { + options = [ + { + name: "Yes", + probability: probability, + type: "PROBABILITY", + }, + { + name: "No", + probability: 1 - probability, + type: "PROBABILITY", + }, + ]; + } } return { id: `${platformName}-${q.id}`,