feat: Quizzes fixed
diff --git a/erpnext/public/js/education/lms/components/Quiz.vue b/erpnext/public/js/education/lms/components/Quiz.vue
index f7afb48..41f5f3a 100644
--- a/erpnext/public/js/education/lms/components/Quiz.vue
+++ b/erpnext/public/js/education/lms/components/Quiz.vue
@@ -73,9 +73,9 @@
submitQuiz() {
lms.call("evaluate_quiz",
{
- enrollment: lms.store.enrolledCourses[this.$route.params.course],
quiz_response: this.quizResponse,
- quiz_name: this.content
+ quiz_name: this.content,
+ course: this.$route.params.course_name
}
).then(data => {
this.score = data,
diff --git a/erpnext/www/lms.py b/erpnext/www/lms.py
index dd3af02..9327175 100644
--- a/erpnext/www/lms.py
+++ b/erpnext/www/lms.py
@@ -101,13 +101,14 @@
return None
@frappe.whitelist()
-def evaluate_quiz(enrollment, quiz_response, quiz_name):
+def evaluate_quiz(course, quiz_response, quiz_name):
"""LMS Function: Evaluates a simple multiple choice quiz.
:param quiz_response: contains user selected choices for a quiz in the form of a string formatted as a dictionary. The function uses `json.loads()` to convert it to a python dictionary.
"""
import json
quiz_response = json.loads(quiz_response)
quiz = frappe.get_doc("Quiz", quiz_name)
+ enrollment = utils.get_course_enrollment(course).name
answers, score, status = quiz.evaluate(quiz_response, quiz_name)
result = {k: ('Correct' if v else 'Wrong') for k,v in answers.items()}