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