feat: course cards

This commit is contained in:
Jannat Patel
2023-11-29 12:05:40 +05:30
parent 25bcd10e93
commit 63bcf15900
7 changed files with 906 additions and 35 deletions

View File

@@ -139,3 +139,13 @@ def add_mentor_to_subgroup(subgroup, email):
sg.add_mentor(email)
return {"ok": True}
@frappe.whitelist(allow_guest=True)
def get_courses():
"""Returns the list of courses."""
return frappe.get_all(
"LMS Course",
fields=["name", "title", "short_introduction", "image"],
filters={"published": True},
)

View File

@@ -178,6 +178,7 @@ def get_lesson_icon(content):
return icon
@frappe.whitelist(allow_guest=True)
def get_tags(course):
tags = frappe.db.get_value("LMS Course", course, "tags")
return tags.split(",") if tags else []