mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-12 17:51:20 +00:00
Minor Fixes: Student Enrollment
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user