2018-10-08 09:56:05 +00:00
|
|
|
from __future__ import unicode_literals
|
2018-10-16 12:24:18 +00:00
|
|
|
import erpnext.education.utils as utils
|
2018-10-08 09:56:05 +00:00
|
|
|
import frappe
|
|
|
|
|
|
|
|
|
|
|
|
def get_context(context):
|
2018-10-18 10:14:08 +00:00
|
|
|
program = frappe.get_doc("Program", frappe.form_dict["program"])
|
|
|
|
course_list = program.get_course_list()
|
|
|
|
|
|
|
|
context.program = program
|
2018-10-24 11:16:46 +00:00
|
|
|
context.course_list = course_list
|
|
|
|
context.check_complete = check_complete
|
|
|
|
|
|
|
|
|
|
|
|
def check_complete(course_name):
|
|
|
|
try:
|
|
|
|
enrollment = utils.get_course_enrollment(course_name, frappe.session.user)
|
|
|
|
completed = frappe.get_value('Course Enrollment', enrollment['name'], "completed")
|
|
|
|
return bool(completed)
|
|
|
|
except:
|
|
|
|
return False
|