Fixed more or less reading import, attempted to do listening
This commit is contained in:
@@ -3,7 +3,7 @@ from typing import Dict, Any
|
||||
from app.dtos.exams.reading import (
|
||||
Part, Exam, Context, FillBlanksExercise,
|
||||
TrueFalseExercise, MatchSentencesExercise,
|
||||
WriteBlanksExercise
|
||||
WriteBlanksExercise, MultipleChoice
|
||||
)
|
||||
|
||||
|
||||
@@ -20,13 +20,18 @@ class ReadingMapper:
|
||||
'fillBlanks': FillBlanksExercise,
|
||||
'trueFalse': TrueFalseExercise,
|
||||
'matchSentences': MatchSentencesExercise,
|
||||
'writeBlanks': WriteBlanksExercise
|
||||
'writeBlanks': WriteBlanksExercise,
|
||||
'multipleChoice': MultipleChoice,
|
||||
}
|
||||
|
||||
exercises = []
|
||||
for exercise in part_exercises:
|
||||
exercise_type = exercise['type']
|
||||
exercises.append(model_map[exercise_type](**exercise))
|
||||
if exercise_type in model_map:
|
||||
model_class = model_map[exercise_type]
|
||||
exercises.append(model_class(**exercise))
|
||||
else:
|
||||
raise ValueError(f"Unknown exercise type: {exercise_type}")
|
||||
|
||||
part_kwargs = {
|
||||
"exercises": exercises,
|
||||
|
||||
Reference in New Issue
Block a user