community_prediction can be null on subquestions

e.g. https://www.metaculus.com/api2/questions/12663/
This commit is contained in:
Vyacheslav Matyukhin 2022-10-26 19:35:03 +04:00
parent 002a0e5e2f
commit 2176c51d5f
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C
2 changed files with 2 additions and 1 deletions

View File

@ -64,6 +64,7 @@ const predictableProps = {
additionalProperties: true, additionalProperties: true,
}, },
}, },
nullable: true,
additionalProperties: true, additionalProperties: true,
}, },
} as const; } as const;

View File

@ -36,7 +36,7 @@ async function apiQuestionToFetchedQuestions(apiQuestion: ApiQuestion): Promise<
const isBinary = q.possibilities.type === "binary"; const isBinary = q.possibilities.type === "binary";
let options: FetchedQuestion["options"] = []; let options: FetchedQuestion["options"] = [];
if (isBinary) { if (isBinary) {
const probability = q.community_prediction.full.q2; const probability = q.community_prediction?.full.q2;
if (probability !== undefined) { if (probability !== undefined) {
options = [ options = [
{ {