refactor: added lms utilities for enrollment and program list
diff --git a/erpnext/www/lms/all_programs.py b/erpnext/www/lms/all_programs.py
index aa10e2b..c0c18c3 100644
--- a/erpnext/www/lms/all_programs.py
+++ b/erpnext/www/lms/all_programs.py
@@ -6,10 +6,4 @@
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()
\ No newline at end of file
diff --git a/erpnext/www/lms/index.py b/erpnext/www/lms/index.py
index 15ca0b4..00f66e7 100644
--- a/erpnext/www/lms/index.py
+++ b/erpnext/www/lms/index.py
@@ -13,15 +13,4 @@
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()
\ No newline at end of file
diff --git a/erpnext/www/lms/program.py b/erpnext/www/lms/program.py
index f38e652..827b11a 100644
--- a/erpnext/www/lms/program.py
+++ b/erpnext/www/lms/program.py
@@ -7,6 +7,7 @@
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: