Added class function for student enrollment

This commit is contained in:
scmmishra 2018-11-03 18:04:19 +05:30 committed by Aditya Hase
parent 734d3e084c
commit 91aa0e07c8

View File

@ -54,6 +54,18 @@ class Student(Document):
enrollments= [frappe.get_doc("Course Enrollment", enrollment.name) for enrollment in enrollments_name_list]
return enrollments
def enroll_in_program(self, program_name):
enrollment = frappe.get_doc({
"doctype": "Program Enrollment",
"student": self.name,
"academic_year": frappe.get_last_doc("Academic Year").name,
"program": program_name,
"enrollment_date": frappe.utils.datetime.datetime.now()
})
enrollment.save()
enrollment.submit()
frappe.db.commit()
def get_timeline_data(doctype, name):
'''Return timeline for attendance'''
return dict(frappe.db.sql('''select unix_timestamp(`date`), count(*)