feat: featured courses

This commit is contained in:
Jannat Patel
2024-05-27 15:30:15 +05:30
parent cb9125632a
commit b7dd488886
12 changed files with 115 additions and 52 deletions

View File

@@ -377,6 +377,7 @@ def get_assigned_badges(member):
return assigned_badges
@frappe.whitelist()
def get_certificates(member):
"""Get certificates for a member."""
return frappe.get_all(

View File

@@ -26,7 +26,7 @@
"published_on",
"column_break_10",
"upcoming",
"column_break_12",
"featured",
"disable_self_learning",
"section_break_18",
"short_introduction",
@@ -169,10 +169,6 @@
"fieldname": "column_break_10",
"fieldtype": "Column Break"
},
{
"fieldname": "column_break_12",
"fieldtype": "Column Break"
},
{
"depends_on": "enable_certification",
"fieldname": "grant_certificate_after",
@@ -247,6 +243,12 @@
"fieldname": "published_on",
"fieldtype": "Date",
"label": "Published On"
},
{
"default": "0",
"fieldname": "featured",
"fieldtype": "Check",
"label": "Featured"
}
],
"is_published_field": "published",
@@ -273,7 +275,7 @@
}
],
"make_attachments_public": 1,
"modified": "2024-05-08 15:11:07.833094",
"modified": "2024-05-24 18:03:38.330443",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Course",

View File

@@ -1266,6 +1266,7 @@ def get_course_details(course):
"short_introduction",
"published",
"upcoming",
"featured",
"disable_self_learning",
"published_on",
"status",
@@ -1347,6 +1348,8 @@ def get_categorized_courses(courses):
for category in categories:
category.sort(key=lambda x: x.enrollment_count, reverse=True)
live.sort(key=lambda x: x.featured, reverse=True)
return {
"live": live,
"new": new,

View File

@@ -15,10 +15,10 @@
<meta name="twitter:title" content="{{ meta.title }}" />
<meta name="twitter:image" content="{{ meta.image }}" />
<meta name="twitter:description" content="{{ meta.description }}" />
<script type="module" crossorigin src="/assets/lms/frontend/assets/index-C-DogOtg.js"></script>
<link rel="modulepreload" crossorigin href="/assets/lms/frontend/assets/frappe-ui-CGsuCsfq.js">
<script type="module" crossorigin src="/assets/lms/frontend/assets/index-DH4LPAyv.js"></script>
<link rel="modulepreload" crossorigin href="/assets/lms/frontend/assets/frappe-ui-Cdm1MNHD.js">
<link rel="stylesheet" crossorigin href="/assets/lms/frontend/assets/frappe-ui-B1gEXx4C.css">
<link rel="stylesheet" crossorigin href="/assets/lms/frontend/assets/index-C1pDkvO9.css">
<link rel="stylesheet" crossorigin href="/assets/lms/frontend/assets/index-CfA8Gbx1.css">
</head>
<body>
<div id="app">

View File

@@ -112,3 +112,21 @@ def get_meta(app_path):
"keywords": "Enrollment Count, Completion, Signups",
"link": "/statistics",
}
if re.match(r"^user/.*$", app_path):
username = app_path.split("/")[1]
user = frappe.db.get_value(
"User",
{
"username": username,
},
["full_name", "user_image", "bio"],
as_dict=True,
)
return {
"title": user.full_name,
"image": user.user_image,
"description": user.bio,
"keywords": f"{user.full_name}, {user.bio}",
"link": f"/user/{username}",
}