diff --git a/erpnext/education/doctype/quiz/quiz.py b/erpnext/education/doctype/quiz/quiz.py index a7d76d5dc3b..2ecc4856cac 100644 --- a/erpnext/education/doctype/quiz/quiz.py +++ b/erpnext/education/doctype/quiz/quiz.py @@ -17,6 +17,11 @@ class Quiz(Document): pass - def get_question(self): - pass + def get_questions(self): + quiz_question = self.get_all_children() + if quiz_question: + questions = [frappe.get_doc('Question', question.question_link) for question in quiz_question] + return questions + else: + return None diff --git a/erpnext/www/lms/course.py b/erpnext/www/lms/course.py index a05725e4368..35c28793e7c 100644 --- a/erpnext/www/lms/course.py +++ b/erpnext/www/lms/course.py @@ -22,6 +22,11 @@ def get_context(context): context.program_name = program_name context.content_type = content_type context.next_content_type, context.next_content = get_next_content(content_name, content_type, current_course.get_content_info()) + if content_type == "Quiz": + context.questions = current_content.get_questions() + print(content_type) + print(current_content.title) + print(context.questions) def get_next_content(c_name, c_type, content_list): try: diff --git a/erpnext/www/lms/templates/includes/quiz.html b/erpnext/www/lms/templates/includes/quiz.html index 6f3a58edc84..83f598eb1c8 100644 --- a/erpnext/www/lms/templates/includes/quiz.html +++ b/erpnext/www/lms/templates/includes/quiz.html @@ -1,15 +1,15 @@ {% macro quiz(loop_index, question) %} -