fix: Default program list

Shows two latest programs if no program is set as featured
This commit is contained in:
scmmishra 2019-03-18 15:40:47 +05:30
parent c22eef28f7
commit 621cad8781

View File

@ -45,14 +45,14 @@ def get_featured_programs():
featured_list = [utils.get_program(program['name']) for program in featured_program_names]
return featured_list
else:
return None
return get_all_programs()[:2]
@frappe.whitelist(allow_guest=True)
def get_all_programs():
program_names = frappe.get_all("Program", filters={"is_published": True})
if program_names:
featured_list = [utils.get_program(program['name']) for program in program_names]
return featured_list
program_list = [utils.get_program(program['name']) for program in program_names]
return program_list
else:
return None