blob: 1a0decce32eae0f5c22bacc75e3319fbc78358c2 [file] [log] [blame]
Shivam Mishra16b41292019-06-05 17:29:48 +05301from __future__ import unicode_literals
2import erpnext.education.utils as utils
3import frappe
4
5no_cache = 1
6
7def get_context(context):
8 context.student = utils.get_current_student()
9 context.progress = get_program_progress(context.student.name)
10
11def get_program_progress(student):
12 enrolled_programs = frappe.get_all("Program Enrollment", filters={'student':student}, fields=['program'])
13 student_progress = []
14 for list_item in enrolled_programs:
15 program = frappe.get_doc("Program", list_item.program)
16 progress = utils.get_program_progress(program)
17 completion = utils.get_program_completion(program)
18 student_progress.append({'program': program.program_name, 'name': program.name, 'progress':progress, 'completion': completion})
19
20 return student_progress
21
22
23
24