Minor Fixes: Student Enrollment

This commit is contained in:
scmmishra
2018-11-23 17:16:22 +05:30
committed by Aditya Hase
parent fdbabde80a
commit 082e3c94ef
2 changed files with 5 additions and 6 deletions

View File

@@ -100,11 +100,12 @@ def get_course_enrollment(course_name):
return None return None
def create_student(): def create_student():
student_name=frappe.session.user user = frappe.get_doc("User", frappe.session.user)
student = frappe.get_doc({ student = frappe.get_doc({
"doctype": "Student", "doctype": "Student",
"first_name": student_name, "first_name": user.first_name,
"student_email_id": student_name, "last_name": user.last_name,
"student_email_id": user.email,
}) })
student.save(ignore_permissions=True) student.save(ignore_permissions=True)
frappe.db.commit() frappe.db.commit()

View File

@@ -101,8 +101,6 @@ def get_quiz_without_answers(quiz_name):
@frappe.whitelist() @frappe.whitelist()
def evaluate_quiz(enrollment, quiz_response, quiz_name): def evaluate_quiz(enrollment, quiz_response, quiz_name):
"""LMS Function: Evaluates a simple multiple choice quiz. """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. :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.
""" """
@@ -143,7 +141,7 @@ def add_quiz_activity(enrollment, quiz_name, result_data, score, status):
@frappe.whitelist() @frappe.whitelist()
def enroll_in_program(program_name): def enroll_in_program(program_name):
if(not utils.get_current_student()): if(not utils.get_current_student()):
utils.create_student(frappe.session.user) utils.create_student()
student = frappe.get_doc("Student", utils.get_current_student()) student = frappe.get_doc("Student", utils.get_current_student())
program_enrollment = student.enroll_in_program(program_name) program_enrollment = student.enroll_in_program(program_name)
utils.enroll_all_courses_in_program(program_enrollment, student) utils.enroll_all_courses_in_program(program_enrollment, student)