@@ -39,8 +53,8 @@
diff --git a/lms/lms/doctype/lms_badge/lms_badge.js b/lms/lms/doctype/lms_badge/lms_badge.js
index 7c031086..aca59b3f 100644
--- a/lms/lms/doctype/lms_badge/lms_badge.js
+++ b/lms/lms/doctype/lms_badge/lms_badge.js
@@ -1,8 +1,26 @@
// Copyright (c) 2024, Frappe and contributors
// For license information, please see license.txt
-// frappe.ui.form.on("LMS Badge", {
-// refresh(frm) {
+frappe.ui.form.on("LMS Badge", {
+ reference_doctype: (frm) => {
+ frm.events.set_fields_to_check(frm);
+ },
-// },
-// });
+ set_fields_to_check: (frm) => {
+ const reference_doctype = frm.doc.reference_doctype;
+ if (!reference_doctype) return;
+
+ frappe.model.with_doctype(reference_doctype, () => {
+ const map_for_options = (df) => ({
+ label: df.label,
+ value: df.fieldname,
+ });
+ const fields = frappe.meta
+ .get_docfields(frm.doc.reference_doctype)
+ .filter(frappe.model.is_value_type);
+
+ const fields_to_check = fields.map(map_for_options);
+ frm.set_df_property("field_to_check", "options", fields_to_check);
+ });
+ },
+});
diff --git a/lms/lms/doctype/lms_badge/lms_badge.json b/lms/lms/doctype/lms_badge/lms_badge.json
index ba54e869..49d5f58c 100644
--- a/lms/lms/doctype/lms_badge/lms_badge.json
+++ b/lms/lms/doctype/lms_badge/lms_badge.json
@@ -85,8 +85,13 @@
}
],
"index_web_pages_for_search": 1,
- "links": [],
- "modified": "2024-04-30 17:16:17.725459",
+ "links": [
+ {
+ "link_doctype": "LMS Badge Assignment",
+ "link_fieldname": "badge"
+ }
+ ],
+ "modified": "2024-05-02 14:23:32.198858",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Badge",
diff --git a/lms/lms/doctype/lms_badge/lms_badge.py b/lms/lms/doctype/lms_badge/lms_badge.py
index 317a5641..9f888de2 100644
--- a/lms/lms/doctype/lms_badge/lms_badge.py
+++ b/lms/lms/doctype/lms_badge/lms_badge.py
@@ -36,7 +36,7 @@ class LMSBadge(Document):
if self.grant_only_once:
if frappe.db.exists(
"LMS Badge Assignment",
- {"badge": self.name, "user": frappe.session.user},
+ {"badge": self.name, "member": frappe.session.user},
):
return
@@ -44,7 +44,7 @@ class LMSBadge(Document):
assignment.update(
{
"badge": self.name,
- "user": frappe.session.user,
+ "member": frappe.session.user,
"issued_on": frappe.utils.now(),
}
)
diff --git a/lms/lms/utils.py b/lms/lms/utils.py
index 83b3e2c9..94254ecc 100644
--- a/lms/lms/utils.py
+++ b/lms/lms/utils.py
@@ -161,6 +161,7 @@ def get_lesson_details(chapter):
)
lesson_details.number = f"{chapter.idx}.{row.idx}"
lesson_details.icon = get_lesson_icon(lesson_details.body)
+ lesson_details.is_complete = get_progress(lesson_details.course, lesson_details.name)
lessons.append(lesson_details)
return lessons
diff --git a/lms/public/frontend/index.html b/lms/public/frontend/index.html
index db378895..65242c87 100644
--- a/lms/public/frontend/index.html
+++ b/lms/public/frontend/index.html
@@ -15,10 +15,10 @@
-
-
+
+
-
+