feat: Added `add_quiz_activity` function to course_enrollment class
diff --git a/erpnext/education/doctype/course_enrollment/course_enrollment.py b/erpnext/education/doctype/course_enrollment/course_enrollment.py
index b57745f..9508636 100644
--- a/erpnext/education/doctype/course_enrollment/course_enrollment.py
+++ b/erpnext/education/doctype/course_enrollment/course_enrollment.py
@@ -30,4 +30,47 @@
 			"program_enrollment": self.program_enrollment
 		})
 		if enrollment:
-			frappe.throw(_("Student is already enrolled."))
\ No newline at end of file
+			frappe.throw(_("Student is already enrolled."))
+
+	def add_quiz_activity(self, quiz_name, quiz_response,answers, score, status):
+		result = {k: ('Correct' if v else 'Wrong') for k,v in answers.items()}
+		result_data = []
+		for key in answers:
+			item = {}
+			item['question'] = key
+			item['quiz_result'] = result[key]
+			try:
+				if isinstance(quiz_response[key], list):
+					item['selected_option'] = ', '.join(frappe.get_value('Options', res, 'option') for res in quiz_response[key])
+				else:
+					item['selected_option'] = frappe.get_value('Options', quiz_response[key], 'option')
+			except KeyError:
+				item['selected_option'] = "Unattempted"
+			result_data.append(item)
+
+		quiz_activity = frappe.get_doc({
+			"doctype": "Quiz Activity",
+			"enrollment": self.name,
+			"quiz": quiz_name,
+			"activity_date": frappe.utils.datetime.datetime.now(),
+			"result": result_data,
+			"score": score,
+			"status": status
+			}).insert()
+
+	def add_activity(self, content_type, content):
+		if check_activity_exists(self.name, content_type, content):
+			pass
+		else:
+			activity = frappe.get_doc({
+				"doctype": "Course Activity",
+				"enrollment": self.name,
+				"content_type": content_type,
+				"content": content,
+				"activity_date": frappe.utils.datetime.datetime.now()
+				})
+			activity.insert()
+
+def check_activity_exists(enrollment, content_type, content):
+	activity = frappe.get_all("Course Activity", filters={'enrollment': enrollment, 'content_type': content_type, 'content': content})
+	return bool(activity)
\ No newline at end of file
diff --git a/erpnext/education/utils.py b/erpnext/education/utils.py
index 93b44e9..d7b768e 100644
--- a/erpnext/education/utils.py
+++ b/erpnext/education/utils.py
@@ -121,10 +121,6 @@
 	student = get_current_student()
 	return student.enroll_in_course(course_name=course_name, program_enrollment=get_program_enrollment(program_name))
 
-def check_activity_exists(enrollment, content_type, content):
-	activity = frappe.get_all("Course Activity", filters={'enrollment': enrollment, 'content_type': content_type, 'content': content})
-	return bool(activity)
-
 def check_content_completion(content_name, content_type, enrollment_name):
 	activity = frappe.get_all("Course Activity", filters={'enrollment': enrollment_name, 'content_type': content_type, 'content': content_name})
 	if activity:
diff --git a/erpnext/www/lms.py b/erpnext/www/lms.py
index f669543..69424e1 100644
--- a/erpnext/www/lms.py
+++ b/erpnext/www/lms.py
@@ -107,38 +107,13 @@
 	quiz_response = json.loads(quiz_response)
 	quiz = frappe.get_doc("Quiz", quiz_name)
 	answers, score, status = quiz.evaluate(quiz_response, quiz_name)
+	print(answers)
 
-	result = {k: ('Correct' if v else 'Wrong') for k,v in answers.items()}
-	result_data = []
-	for key in answers:
-		item = {}
-		item['question'] = key
-		item['quiz_result'] = result[key]
-		try:
-			if isinstance(quiz_response[key], list):
-				item['selected_option'] = ', '.join(frappe.get_value('Options', res, 'option') for res in quiz_response[key])
-			else:
-				item['selected_option'] = frappe.get_value('Options', quiz_response[key], 'option')
-		except:
-			item['selected_option'] = "Unattempted"
-		result_data.append(item)
+	course_enrollment = utils.get_course_enrollment(course)
+	if course_enrollment:
+		course_enrollment.add_quiz_activity(quiz_name, quiz_response, answers, score, status)
 
-	add_quiz_activity(course, quiz_name, result_data, score, status)
-	return(score)
-
-def add_quiz_activity(course, quiz_name, result_data, score, status):
-	if not utils.get_current_student():
-		return None
-	enrollment = utils.get_course_enrollment(course).name
-	quiz_activity = frappe.get_doc({
-		"doctype": "Quiz Activity",
-		"enrollment": enrollment,
-		"quiz": quiz_name,
-		"activity_date": frappe.utils.datetime.datetime.now(),
-		"result": result_data,
-		"score": score,
-		"status": status
-		}).insert()
+	return score
 
 @frappe.whitelist()
 def enroll_in_program(program_name):
@@ -148,24 +123,13 @@
 	program_enrollment = student.enroll_in_program(program_name)
 	return program_name
 
-# Academty Activity
+# Academdy Activity
 @frappe.whitelist()
 def add_activity(course, content_type, content):
 	if not utils.get_current_student():
 		return
 	enrollment = utils.get_course_enrollment(course)
-	if(utils.check_activity_exists(enrollment.name, content_type, content)):
-		pass
-	else:
-		activity = frappe.get_doc({
-			"doctype": "Course Activity",
-			"enrollment": enrollment.name,
-			"content_type": content_type,
-			"content": content,
-			"activity_date": frappe.utils.datetime.datetime.now()
-			})
-		activity.save()
-		frappe.db.commit()
+	enrollment.add_activity(content_type, content)
 
 @frappe.whitelist()
 def get_student_course_details(course_name, program_name):