Added Speaking to level, fixed a bug where it was causing level to crash if the listening was already created and the section was switched, added true false exercises to listening

This commit is contained in:
Carlos-Mesquita
2024-11-13 20:32:59 +00:00
parent 153d7f5448
commit 8cb09e349f
23 changed files with 1122 additions and 292 deletions

View File

@@ -166,7 +166,22 @@ const listening = (section: number) => {
generate()
],
module: "listening"
}
},
{
label: `Section ${section} - True False`,
type: `listening_${section}`,
icon: FaCheckSquare,
sectionId: section,
extra: [
{
param: "name",
value: "trueFalse"
},
quantity(4, "Quantity of Statements"),
generate()
],
module: "listening"
},
];
if (section === 1 || section === 4) {
@@ -285,7 +300,8 @@ const EXERCISES: ExerciseGen[] = [
],
module: "level"
},
{
// Removing this since level supports reading aswell
/*{
label: "Reading Passage: Multiple Choice",
type: "passageUtas",
icon: FaBookOpen,
@@ -295,11 +311,11 @@ const EXERCISES: ExerciseGen[] = [
value: "passageUtas"
},
// in the utas exam there was only mc so I'm assuming short answers are deprecated
/*{
label: "Short Answers",
param: "sa_qty",
value: "10"
},*/
//{
// label: "Short Answers",
// param: "sa_qty",
// value: "10"
//},
quantity(10, "Multiple Choice Quantity"),
{
label: "Reading Passage Topic",
@@ -315,7 +331,7 @@ const EXERCISES: ExerciseGen[] = [
generate()
],
module: "level"
},
},*/
{
label: "Task 1 - Letter",
type: "writing_letter",

View File

@@ -130,25 +130,51 @@ const ExercisePicker: React.FC<ExercisePickerProps> = ({
);
});
} else {
/*const newExercises = configurations.map((config) => {
switch (config.type) {
case 'writing_letter':
return { ...writingTask(1), level: true };
case 'writing_2':
return { ...writingTask(2), level: true };
}
return undefined;
}).filter((ex) => ex !== undefined);
dispatch({
type: "UPDATE_SECTION_STATE", payload: {
module: level ? "level" : module as Module, sectionId, update: {
exercises: [
...(sections.find((s) => s.sectionId = sectionId)?.state as LevelPart).exercises,
...newExercises
]
}
}
})*/
configurations.forEach((config) => {
let queryParams = Object.fromEntries(
Object.entries({
topic: config.params.topic as string,
first_topic: config.params.first_topic as string,
second_topic: config.params.second_topic as string,
}).filter(([_, value]) => value && value !== '')
);
let query = Object.keys(queryParams).length === 0 ? undefined : queryParams;
generate(
Number(config.type.split('_')[1]),
"speaking",
config.type,
{
method: 'GET',
queryParams: query
},
(data: any) => {
switch (Number(config.type.split('_')[1])) {
case 1:
return [{
prompts: data.questions,
first_topic: data.first_topic,
second_topic: data.second_topic
}];
case 2:
return [{
topic: data.topic,
question: data.question,
prompts: data.prompts,
suffix: data.suffix
}];
case 3:
return [{
topic: data.topic,
questions: data.questions
}];
default:
return [data];
}
},
levelSectionId,
level
);
});
}
setLocalSelectedExercises([]);
setPickerOpen(false);