Skip to content

Commit

Permalink
Merge branch 'frontend' into map-with-api
Browse files Browse the repository at this point in the history
  • Loading branch information
semant1cs committed Nov 21, 2023
2 parents f22cc60 + 0220c84 commit 3baf939
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions backend/src/repository/question_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class QuestionRepository(SQLAlchemyRepository):

async def add_one(self, model: dict[str, typing.Any]) -> Question:
async with async_session_maker() as session:
possible_answers_list = model.pop('possible_answers')
answer_options_list = model.pop('answer_options')
question_to_add = Question(**model)

possible_answers = [AnswerOption(**answer_option_dict, question_id=question_to_add.id) for
answer_option_dict in possible_answers_list]
answer_option_dict in answer_options_list]
for answer_option in possible_answers:
question_to_add.answer_options.append(answer_option)

Expand Down
2 changes: 1 addition & 1 deletion backend/src/services/question_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self, repository: type[AbstractRepository]):
self.__question_repo = repository()

async def create_one(self, task_id: uuid.UUID, schema_create: QuestionCreate) -> QuestionRead:
schema_dict = schema_create.model_dump(include={'type', 'possible_answers', 'question'})
schema_dict = schema_create.model_dump(include={'type', 'answer_options', 'question'})
schema_dict['task_id'] = task_id
return await self.__question_repo.add_one(schema_dict)

Expand Down

0 comments on commit 3baf939

Please sign in to comment.