Patched backend eval

This commit is contained in:
Carlos-Mesquita
2024-11-26 09:08:12 +00:00
parent 6e0276b79d
commit 47cdfe1478
9 changed files with 47 additions and 21 deletions

View File

@@ -8,7 +8,7 @@ class IGradeController(ABC):
@abstractmethod
async def grade_writing_task(
self, session_id: str, exercise_id: str,
self,
task: int, dto: any,
background_tasks: BackgroundTasks
):

View File

@@ -23,21 +23,22 @@ class GradeController(IGradeController):
self._logger = logging.getLogger(__name__)
async def grade_writing_task(
self, session_id: str, exercise_id: str,
self,
task: int, dto: WritingGradeTaskDTO, background_tasks: BackgroundTasks
):
await self._evaluation_service.create_or_update_evaluation(
dto.sessionId, dto.exercise_id, EvaluationType.WRITING, task
await self._evaluation_service.create_evaluation(
dto.userId, dto.sessionId, dto.exerciseId, EvaluationType.WRITING, task
)
await self._evaluation_service.begin_evaluation(
session_id, task, exercise_id, EvaluationType.WRITING, dto, background_tasks
dto.userId, dto.sessionId, task, dto.exerciseId, EvaluationType.WRITING, dto, background_tasks
)
return Response(status_code=200)
async def grade_speaking_task(self, task: int, form: FormData, background_tasks: BackgroundTasks):
answers: Dict[int, Dict] = {}
user_id = form.get("userId")
session_id = form.get("sessionId")
exercise_id = form.get("exerciseId")
@@ -79,12 +80,12 @@ class GradeController(IGradeController):
ex_type = EvaluationType.SPEAKING if task == 2 else EvaluationType.SPEAKING_INTERACTIVE
await self._evaluation_service.create_or_update_evaluation(
session_id, exercise_id, ex_type, task
await self._evaluation_service.create_evaluation(
user_id, session_id, exercise_id, ex_type, task
)
await self._evaluation_service.begin_evaluation(
session_id, task, exercise_id, ex_type, items, background_tasks
user_id, session_id, task, exercise_id, ex_type, items, background_tasks
)
return Response(status_code=200)