diff --git a/backend/src/game/units/tasks/enums.py b/backend/src/game/units/tasks/enums.py index 5ba4f57..35af84a 100644 --- a/backend/src/game/units/tasks/enums.py +++ b/backend/src/game/units/tasks/enums.py @@ -1,11 +1,11 @@ -from enum import Enum, auto, StrEnum +from enum import StrEnum, auto class TaskTypes(StrEnum): Test = auto() -class TaskStates(Enum): +class TaskStates(StrEnum): NotViewed = auto() Viewed = auto() Submitted = auto() diff --git a/backend/src/game/units/tasks/questions/answers/schemas.py b/backend/src/game/units/tasks/questions/answers/schemas.py index cd1a2ba..5d8fd66 100644 --- a/backend/src/game/units/tasks/questions/answers/schemas.py +++ b/backend/src/game/units/tasks/questions/answers/schemas.py @@ -19,3 +19,11 @@ class AnswerOptionCreate(__AnswerBase): class AnswerOptionUpdate(__AnswerBase): answer: str | None = None is_correct: bool | None = None + + +class EmployeeAnswerPost(__AnswerBase): + is_selected: bool + + +class EmployeeAnswerRead(__AnswerBase): + was_selected_correct: bool diff --git a/backend/src/game/units/tasks/questions/router.py b/backend/src/game/units/tasks/questions/router.py index 4730248..cad2d1d 100644 --- a/backend/src/game/units/tasks/questions/router.py +++ b/backend/src/game/units/tasks/questions/router.py @@ -2,8 +2,9 @@ from fastapi import APIRouter -from game.units.tasks.questions.schemas import QuestionRead, QuestionCreate, QuestionUpdate -from utils.types import QuestionServiceType +from game.units.tasks.questions.schemas import QuestionRead, QuestionCreate, QuestionUpdate, EmployeeQuestionPost, \ + EmployeeQuestionRead +from utils.types import QuestionServiceType, TaskUnitServiceType router = APIRouter(tags=["Questions"]) @@ -23,6 +24,16 @@ async def post_question_to_task_unit(map_id: UUID, return await question_service.create_one(task_id, question_create) +@router.post("/maps/{map_id}/modules/{module_id}/levels/{level_id}/tasks/{task_id}/check/") +async def autocheck_task_unit(map_id: UUID, + module_id: UUID, + level_id: UUID, + task_id: UUID, + employee_answers: list[EmployeeQuestionPost], + task_service: TaskUnitServiceType) -> list[EmployeeQuestionRead]: + return [] + + @router.delete("/maps/{map_id}/modules/{module_id}/levels/{level_id}/tasks/{task_id}/questions/{question_id}/") async def delete_question_from_task_unit(map_id: UUID, module_id: UUID, diff --git a/backend/src/game/units/tasks/questions/schemas.py b/backend/src/game/units/tasks/questions/schemas.py index d7d485f..1299eb0 100644 --- a/backend/src/game/units/tasks/questions/schemas.py +++ b/backend/src/game/units/tasks/questions/schemas.py @@ -2,7 +2,8 @@ from pydantic import BaseModel, ConfigDict -from game.units.tasks.questions.answers.schemas import AnswerOptionRead, AnswerOptionCreate +from game.units.tasks.questions.answers.schemas import AnswerOptionRead, AnswerOptionCreate, EmployeeAnswerPost, \ + EmployeeAnswerRead from game.units.tasks.questions.enums import QuestionTypes @@ -28,3 +29,11 @@ class QuestionUpdate(__QuestionBase): type: QuestionTypes | None = None question: str | None = None answer_options: list[AnswerOptionCreate] | None = None + + +class EmployeeQuestionPost(__QuestionBase): + answers: list[EmployeeAnswerPost] + + +class EmployeeQuestionRead(__QuestionBase): + results: list[EmployeeAnswerRead] diff --git a/backend/src/game/units/tasks/schemas.py b/backend/src/game/units/tasks/schemas.py index cde51ce..64414ee 100644 --- a/backend/src/game/units/tasks/schemas.py +++ b/backend/src/game/units/tasks/schemas.py @@ -2,7 +2,7 @@ from pydantic import BaseModel, ConfigDict -from game.units.tasks.questions.schemas import QuestionRead, QuestionCreate, QuestionUpdate +from game.units.tasks.questions.schemas import QuestionRead from game.units.tasks.enums import TaskTypes