mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 18:59:08 +00:00
refactor: added lms utilities for enrollment and program list
This commit is contained in:
@@ -6,10 +6,4 @@ no_cache = 1
|
||||
|
||||
def get_context(context):
|
||||
context.education_settings = frappe.get_single("Education Settings")
|
||||
context.all_programs = get_all_programs()
|
||||
|
||||
def get_all_programs():
|
||||
program_names = frappe.get_all("Program", filters={"is_published": True})
|
||||
if program_names:
|
||||
program_list = [utils.get_program_and_enrollment_status(program['name']) for program in program_names]
|
||||
return program_list
|
||||
context.all_programs = utils.get_portal_programs()
|
||||
@@ -13,15 +13,4 @@ def get_context(context):
|
||||
|
||||
|
||||
def get_featured_programs():
|
||||
featured_program_names = frappe.get_all("Program", filters={"is_published": True, "is_featured": True})
|
||||
if featured_program_names:
|
||||
featured_list = [utils.get_program_and_enrollment_status(program['name']) for program in featured_program_names]
|
||||
return featured_list
|
||||
else:
|
||||
return get_all_programs()[:2]
|
||||
|
||||
def get_all_programs():
|
||||
program_names = frappe.get_all("Program", filters={"is_published": True})
|
||||
if program_names:
|
||||
program_list = [utils.get_program_and_enrollment_status(program['name']) for program in program_names]
|
||||
return program_list
|
||||
return utils.get_portal_programs()
|
||||
@@ -7,6 +7,7 @@ no_cache = 1
|
||||
def get_context(context):
|
||||
context.education_settings = frappe.get_single("Education Settings")
|
||||
context.program = get_program(frappe.form_dict['name'])
|
||||
context.is_enrolled = utils.get_enrollment_status(program)
|
||||
|
||||
def get_program(program_name):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user