fix: metaculus on groups
This commit is contained in:
parent
5bf24a58ef
commit
ceeeff9681
|
@ -106,6 +106,9 @@ const questionSchema = {
|
|||
properties: {
|
||||
...commonProps,
|
||||
...pageProps,
|
||||
},
|
||||
optionalProperties: {
|
||||
...optionalPageProps,
|
||||
sub_questions: {
|
||||
elements: {
|
||||
properties: {
|
||||
|
@ -116,9 +119,6 @@ const questionSchema = {
|
|||
},
|
||||
},
|
||||
},
|
||||
optionalProperties: {
|
||||
...optionalPageProps,
|
||||
},
|
||||
additionalProperties: true,
|
||||
},
|
||||
// we're not interested in claims currently (but we should be?)
|
||||
|
|
|
@ -74,7 +74,10 @@ async function apiQuestionToFetchedQuestions(
|
|||
if (apiQuestion.type === "group") {
|
||||
await sleep(SLEEP_TIME);
|
||||
const apiQuestionDetails = await fetchSingleApiQuestion(apiQuestion.id);
|
||||
return apiQuestion.sub_questions
|
||||
if (apiQuestionDetails.type !== "group") {
|
||||
throw new Error("Expected `group` type"); // shouldn't happen, this is mostly for typescript
|
||||
}
|
||||
return (apiQuestionDetails.sub_questions || [])
|
||||
.filter((q) => !skip(q))
|
||||
.map((sq) => {
|
||||
const tmp = buildFetchedQuestion(sq);
|
||||
|
|
Loading…
Reference in New Issue
Block a user