Minor Changes

This commit is contained in:
scmmishra 2018-10-29 13:03:45 +05:30 committed by Aditya Hase
parent 75ad128912
commit 5e758aea00
2 changed files with 7 additions and 6 deletions

View File

@ -38,7 +38,7 @@ def enroll_student(source_name):
program_enrollment.student = student.name program_enrollment.student = student.name
program_enrollment.student_name = student.title program_enrollment.student_name = student.title
program_enrollment.program = frappe.db.get_value("Student Applicant", source_name, "program") program_enrollment.program = frappe.db.get_value("Student Applicant", source_name, "program")
frappe.publish_realtime('enroll_student_progress', {"progress": [4, 4]}, user=frappe.session.user) frappe.publish_realtime('enroll_student_progress', {"progress": [2, 4]}, user=frappe.session.user)
student_user = frappe.get_doc({ student_user = frappe.get_doc({
'doctype':'User', 'doctype':'User',
'first_name': student.first_name, 'first_name': student.first_name,
@ -48,6 +48,7 @@ def enroll_student(source_name):
}) })
student_user.add_roles("Student", "LMS User") student_user.add_roles("Student", "LMS User")
student_user.save() student_user.save()
frappe.publish_realtime('enroll_student_progress', {"progress": [4, 4]}, user=frappe.session.user)
update_password_link = student_user.reset_password() update_password_link = student_user.reset_password()
print(update_password_link) print(update_password_link)
return program_enrollment return program_enrollment
@ -80,7 +81,7 @@ def mark_attendance(students_present, students_absent, course_schedule=None, stu
present = json.loads(students_present) present = json.loads(students_present)
absent = json.loads(students_absent) absent = json.loads(students_absent)
for d in present: for d in present:
make_attendance_records(d["student"], d["student_name"], "Present", course_schedule, student_group, date) make_attendance_records(d["student"], d["student_name"], "Present", course_schedule, student_group, date)
@ -100,7 +101,7 @@ def make_attendance_records(student, student_name, status, course_schedule=None,
:param status: Status (Present/Absent) :param status: Status (Present/Absent)
""" """
student_attendance = frappe.get_doc({ student_attendance = frappe.get_doc({
"doctype": "Student Attendance", "doctype": "Student Attendance",
"student": student, "student": student,
"course_schedule": course_schedule, "course_schedule": course_schedule,
"student_group": student_group, "student_group": student_group,
@ -123,7 +124,7 @@ def get_student_guardians(student):
:param student: Student. :param student: Student.
""" """
guardians = frappe.get_list("Student Guardian", fields=["guardian"] , guardians = frappe.get_list("Student Guardian", fields=["guardian"] ,
filters={"parent": student}) filters={"parent": student})
return guardians return guardians
@ -364,7 +365,7 @@ def update_email_group(doctype, name):
for guard in get_student_guardians(stud.student): for guard in get_student_guardians(stud.student):
email = frappe.db.get_value("Guardian", guard.guardian, "email_address") email = frappe.db.get_value("Guardian", guard.guardian, "email_address")
if email: if email:
email_list.append(email) email_list.append(email)
add_subscribers(name, email_list) add_subscribers(name, email_list)
@frappe.whitelist() @frappe.whitelist()

View File

@ -48,7 +48,7 @@ class ProgramEnrollmentTool(Document):
return students return students
else: else:
frappe.throw(_("No students Found")) frappe.throw(_("No students Found"))
def enroll_students(self): def enroll_students(self):
total = len(self.students) total = len(self.students)
for i, stud in enumerate(self.students): for i, stud in enumerate(self.students):