Quiz Logic
diff --git a/erpnext/education/doctype/quiz/quiz.py b/erpnext/education/doctype/quiz/quiz.py
index 4bb6a78..7b5da93 100644
--- a/erpnext/education/doctype/quiz/quiz.py
+++ b/erpnext/education/doctype/quiz/quiz.py
@@ -16,9 +16,8 @@
def evaluate(self, response_dict):
self.get_questions()
answers = {q.name:q.get_answer() for q in self.get_questions()}
- correct_answers = [{'question':question,'selected_option':response_dict[question],'result':(answers[question] == response_dict[question])} for question in response_dict.keys()]
- print(correct_answers)
- return correct_answers, (sum(answer['result'] for answer in correct_answers) * 100 ) / len(answers)
+ correct_answers = [answers[question] == response_dict[question] for question in response_dict.keys()]
+ return (sum(correct_answers) * 100 ) / len(answers)
def get_questions(self):
diff --git a/erpnext/education/doctype/quiz_result/quiz_result.json b/erpnext/education/doctype/quiz_result/quiz_result.json
index 7b32694..4451aaf 100644
--- a/erpnext/education/doctype/quiz_result/quiz_result.json
+++ b/erpnext/education/doctype/quiz_result/quiz_result.json
@@ -86,7 +86,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "correct_option",
+ "fieldname": "result",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
@@ -123,8 +123,8 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2018-10-15 16:17:35.779634",
- "modified_by": "Administrator",
+ "modified": "2018-10-22 12:28:07.597474",
+ "modified_by": "jess@education.com",
"module": "Education",
"name": "Quiz Result",
"name_case": "",
diff --git a/erpnext/education/utils.py b/erpnext/education/utils.py
index a3763c1..d0bf907 100644
--- a/erpnext/education/utils.py
+++ b/erpnext/education/utils.py
@@ -66,8 +66,8 @@
course_name = kwargs.get('course')
try:
quiz = frappe.get_doc("Quiz", quiz_name)
- result, score = quiz.evaluate(quiz_response)
- add_quiz_activity(course_name, quiz_name, result, score)
+ score = quiz.evaluate(quiz_response)
+ # add_quiz_activity(course_name, quiz_name, result, score)
return score
except frappe.DoesNotExistError:
frappe.throw("Quiz {0} does not exist".format(quiz_name))