Skip to content

Commit

Permalink
fix: async data prep functions should use Promise.resolve (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefl authored Jan 13, 2025
1 parent cb183fb commit 4bc7cd8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions packages/exports/src/dataHelpers/prepLessonForSlides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export async function prepLessonForSlides(
learning_cycle_3_practise: data.cycle3?.practice ?? "",
learning_cycle_3_feedback: data.cycle3?.feedback ?? "",
};
return newData;
return Promise.resolve(newData);
}

type QuizDesignerSlidesTemplateData = {
Expand Down Expand Up @@ -601,7 +601,7 @@ export async function prepQuizDesignerForSlides(
data.questions[19]?.distractors,
)[2] ?? "",
};
return newData;
return Promise.resolve(newData);
}

export async function prepLessonForAdditionalMaterialsDoc(
Expand All @@ -611,5 +611,5 @@ export async function prepLessonForAdditionalMaterialsDoc(
lesson_title: data.title,
content: data.additionalMaterials ?? "",
};
return newData;
return Promise.resolve(newData);
}
4 changes: 2 additions & 2 deletions packages/exports/src/dataHelpers/prepLessonPlanForDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function processQuizAnswersForLessonPlanDoc(
export async function prepLessonPlanForDocs(
lessonPlan: LessonPlanDocInputData,
): Promise<LessonPlanDocsTemplateData> {
return {
return Promise.resolve({
lesson_title: lessonPlan.title,
subject: lessonPlan.subject,
key_stage: camelCaseToTitleCase(lessonPlan.keyStage) ?? "",
Expand Down Expand Up @@ -400,5 +400,5 @@ export async function prepLessonPlanForDocs(
)[2] ?? "",
cycle_3_practice: lessonPlan.cycle3?.practice ?? " ",
cycle_3_feedback: lessonPlan.cycle3?.feedback ?? " ",
};
});
}
4 changes: 2 additions & 2 deletions packages/exports/src/dataHelpers/prepQuizForDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function prepQuizForDocs({
}) {
const quizTypeText = quizType === "exit" ? "Exit quiz" : "Starter quiz";

return {
return Promise.resolve({
lesson_title: title,
quiz_type: quizTypeText,
question_1: processQuizQuestionText(quiz[0]?.question, 0),
Expand Down Expand Up @@ -96,5 +96,5 @@ export async function prepQuizForDocs({
question_6_answer_c:
processQuizAnswersForQuiz(quiz[5]?.answers, quiz[5]?.distractors)[2] ??
" ",
};
});
}
4 changes: 2 additions & 2 deletions packages/exports/src/dataHelpers/prepWorksheetForSlides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ export async function prepWorksheetForSlides(
"title" | "cycle1" | "cycle2" | "cycle3"
>,
) {
return {
return Promise.resolve({
lesson_title: lessonPlan.title,
learning_cycle_title_1: lessonPlan.cycle1.title ?? " ",
practice_task_1: lessonPlan.cycle1.practice ?? " ",
learning_cycle_title_2: lessonPlan?.cycle2?.title ?? " ",
practice_task_2: lessonPlan?.cycle2?.practice ?? " ",
learning_cycle_title_3: lessonPlan?.cycle3?.title ?? " ",
practice_task_3: lessonPlan?.cycle3?.practice ?? " ",
};
});
}

0 comments on commit 4bc7cd8

Please sign in to comment.