fix: logic on the get quiz recomendation
This commit is contained in:
parent
faf6a0f4b9
commit
82faab1cc5
|
@ -123,7 +123,6 @@ class QuizService:
|
|||
return result
|
||||
|
||||
def get_quiz_recommendation(self, user_id: str, page: int, limit: int):
|
||||
current_app.logger.info("in here is should execute")
|
||||
user_answer = self.answer_repository.get_by_user(user_id=user_id)
|
||||
|
||||
if not user_answer:
|
||||
|
@ -137,8 +136,17 @@ class QuizService:
|
|||
|
||||
quiz_subjects = list({quiz.subject_id for quiz in quiz_work})
|
||||
|
||||
result = self.quiz_repository.get_random_quizzes_by_subjects(
|
||||
quiz_data = self.quiz_repository.get_random_quizzes_by_subjects(
|
||||
subject_ids=quiz_subjects, limit=limit
|
||||
)
|
||||
result = []
|
||||
for quiz in quiz_data:
|
||||
author = self.user_repostory.get_user_by_id(user_id=quiz.author_id)
|
||||
result.append(
|
||||
QuizMapper.quiz_to_populer_mapper(
|
||||
quiz_entity=quiz,
|
||||
user_entity=author,
|
||||
)
|
||||
)
|
||||
|
||||
return result
|
||||
|
|
Loading…
Reference in New Issue