+
{{speaker_doc.company}}
diff --git a/school/event_management/web_template/talk_section/talk_section.html b/school/event_management/web_template/talk_section/talk_section.html
index f6ababe3..bb8c10ef 100644
--- a/school/event_management/web_template/talk_section/talk_section.html
+++ b/school/event_management/web_template/talk_section/talk_section.html
@@ -60,7 +60,7 @@
{{ widgets.Avatar(member=member, avatar_class="avatar-small")}}
{{ member.full_name }}
-
+
Vew Talk
diff --git a/school/hooks.py b/school/hooks.py
index 605ff7d4..391e73a1 100644
--- a/school/hooks.py
+++ b/school/hooks.py
@@ -182,6 +182,8 @@ jinja = {
"school.lms.utils.get_mentors",
"school.lms.utils.get_reviews",
"school.lms.utils.is_eligible_to_review",
+ "school.lms.utils.get_initial_members",
+ "school.lms.utils.get_sorted_reviews"
],
"filters": []
}
diff --git a/school/lms/doctype/lms_certification/lms_certification.py b/school/lms/doctype/lms_certification/lms_certification.py
index 0625506a..4f57c484 100644
--- a/school/lms/doctype/lms_certification/lms_certification.py
+++ b/school/lms/doctype/lms_certification/lms_certification.py
@@ -6,6 +6,7 @@ from frappe.model.document import Document
from frappe.utils import nowdate, add_years
from frappe import _
from frappe.utils.pdf import get_pdf
+from school.lms.utils import is_certified
class LMSCertification(Document):
@@ -22,8 +23,7 @@ class LMSCertification(Document):
@frappe.whitelist()
def create_certificate(course):
- course_details = frappe.get_doc("LMS Course", course)
- certificate = course_details.is_certified()
+ certificate = is_certified()
if certificate:
return certificate
diff --git a/school/lms/doctype/lms_course/lms_course.js b/school/lms/doctype/lms_course/lms_course.js
index d40f641e..f9280ab2 100644
--- a/school/lms/doctype/lms_course/lms_course.js
+++ b/school/lms/doctype/lms_course/lms_course.js
@@ -20,6 +20,14 @@ frappe.ui.form.on('LMS Course', {
}
};
});
+
+ frm.set_query("course", "related_courses", function () {
+ return {
+ filters: {
+ "is_published": true,
+ }
+ };
+ });
}
});
diff --git a/school/lms/doctype/lms_course/lms_course.json b/school/lms/doctype/lms_course/lms_course.json
index 5b63e616..84abccb2 100644
--- a/school/lms/doctype/lms_course/lms_course.json
+++ b/school/lms/doctype/lms_course/lms_course.json
@@ -10,7 +10,7 @@
"allow_guest_to_view": 1,
"allow_import": 1,
"allow_rename": 1,
- "creation": "2021-03-01 16:49:33.622422",
+ "creation": "2022-02-08 16:34:42.721203",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
@@ -31,6 +31,7 @@
"short_introduction",
"description",
"chapters",
+ "related_courses",
"certification_section",
"enable_certification",
"expiry"
@@ -141,6 +142,12 @@
"fieldtype": "Select",
"label": "Certification Expires After Years",
"options": "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10"
+ },
+ {
+ "fieldname": "related_courses",
+ "fieldtype": "Table",
+ "label": "Related Courses",
+ "options": "Related Courses"
}
],
"index_web_pages_for_search": 1,
@@ -167,7 +174,7 @@
"link_fieldname": "course"
}
],
- "modified": "2022-02-07 11:41:39.735325",
+ "modified": "2022-02-16 11:50:20.661085",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Course",
@@ -192,4 +199,4 @@
"states": [],
"title_field": "title",
"track_changes": 1
-}
+}
\ No newline at end of file
diff --git a/school/lms/doctype/related_courses/__init__.py b/school/lms/doctype/related_courses/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/school/lms/doctype/related_courses/related_courses.js b/school/lms/doctype/related_courses/related_courses.js
new file mode 100644
index 00000000..b68c26c2
--- /dev/null
+++ b/school/lms/doctype/related_courses/related_courses.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2022, Frappe and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Related Courses', {
+ // refresh: function(frm) {
+
+ // }
+});
diff --git a/school/lms/doctype/related_courses/related_courses.json b/school/lms/doctype/related_courses/related_courses.json
new file mode 100644
index 00000000..0401eab6
--- /dev/null
+++ b/school/lms/doctype/related_courses/related_courses.json
@@ -0,0 +1,32 @@
+{
+ "actions": [],
+ "allow_rename": 1,
+ "creation": "2022-02-16 11:45:07.200407",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+ "course"
+ ],
+ "fields": [
+ {
+ "fieldname": "course",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Course",
+ "options": "LMS Course"
+ }
+ ],
+ "index_web_pages_for_search": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2022-02-16 11:48:30.964916",
+ "modified_by": "Administrator",
+ "module": "LMS",
+ "name": "Related Courses",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": []
+}
\ No newline at end of file
diff --git a/school/lms/doctype/related_courses/related_courses.py b/school/lms/doctype/related_courses/related_courses.py
new file mode 100644
index 00000000..443ad08b
--- /dev/null
+++ b/school/lms/doctype/related_courses/related_courses.py
@@ -0,0 +1,8 @@
+# Copyright (c) 2022, Frappe and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+class RelatedCourses(Document):
+ pass
diff --git a/school/lms/doctype/related_courses/test_related_courses.py b/school/lms/doctype/related_courses/test_related_courses.py
new file mode 100644
index 00000000..6bac57b7
--- /dev/null
+++ b/school/lms/doctype/related_courses/test_related_courses.py
@@ -0,0 +1,8 @@
+# Copyright (c) 2022, Frappe and Contributors
+# See license.txt
+
+# import frappe
+import unittest
+
+class TestRelatedCourses(unittest.TestCase):
+ pass
diff --git a/school/lms/md.py b/school/lms/md.py
index 5acb6322..b072af2a 100644
--- a/school/lms/md.py
+++ b/school/lms/md.py
@@ -105,7 +105,7 @@ def sanitize_html(html, macro):
any broken tags. This makes sures that all those things are fixed
before passing to the etree parser.
"""
- soup = BeautifulSoup(html, features="lxml")
+ soup = BeautifulSoup(html, features="html5lib")
nodes = soup.body.children
classname = ""
if macro == "YouTubeVideo":
diff --git a/school/lms/utils.py b/school/lms/utils.py
index 52f17a5d..51ec23c6 100644
--- a/school/lms/utils.py
+++ b/school/lms/utils.py
@@ -1,6 +1,6 @@
import re
import frappe
-from frappe.utils import flt, cint
+from frappe.utils import flt, cint, cstr
from school.lms.md import markdown_to_html
RE_SLUG_NOTALLOWED = re.compile("[^a-z0-9]+")
@@ -128,7 +128,7 @@ def get_reviews(course):
{
"course": course
},
- ["review", "rating", "owner"],
+ ["review", "rating", "owner", "creation"],
order_by= "creation desc")
out_of_ratings = frappe.db.get_all("DocField",
{
@@ -144,6 +144,22 @@ def get_reviews(course):
return reviews
+def get_sorted_reviews(course):
+ rating_count = rating_percent = frappe._dict()
+ keys = ["5.0", "4.0", "3.0", "2.0", "1.0"]
+ for key in keys:
+ rating_count[key] = 0
+
+ reviews = get_reviews(course)
+ for review in reviews:
+ rating_count[cstr(review.rating)] += 1
+
+ for key in keys:
+ rating_percent[key] = (rating_count[key]/len(reviews) * 100)
+
+
+ return rating_percent
+
def is_certified(course):
certificate = frappe.get_all("LMS Certification",
{
@@ -258,3 +274,18 @@ def get_course_progress(course, member=None):
})
precision = cint(frappe.db.get_default("float_precision")) or 3
return flt(((completed_lessons/lesson_count) * 100), precision)
+
+def get_initial_members(course):
+ members = frappe.get_all("LMS Batch Membership",
+ {
+ "course": course
+ },
+ ["member"],
+ limit=3)
+
+ member_details = []
+ for member in members:
+ member_details.append(frappe.db.get_value("User",
+ member.member, ["name", "username", "full_name", "user_image"], as_dict=True))
+
+ return member_details
diff --git a/school/lms/web_template/course_cards/course_cards.html b/school/lms/web_template/course_cards/course_cards.html
index cbf9563a..405697e7 100644
--- a/school/lms/web_template/course_cards/course_cards.html
+++ b/school/lms/web_template/course_cards/course_cards.html
@@ -7,10 +7,8 @@
{{ widgets.CourseCard(course=course, read_only=False) }}
{% endfor %}
-
-
- Explore More
-
-
+
+ {{ _("Explore More") }}
+
diff --git a/school/lms/widgets/ChapterTeaser.html b/school/lms/widgets/ChapterTeaser.html
deleted file mode 100644
index 7376acfd..00000000
--- a/school/lms/widgets/ChapterTeaser.html
+++ /dev/null
@@ -1,123 +0,0 @@
-
-{% endif %}
-
-
diff --git a/school/lms/widgets/CourseCard.html b/school/lms/widgets/CourseCard.html
index 8e089921..52f613ed 100644
--- a/school/lms/widgets/CourseCard.html
+++ b/school/lms/widgets/CourseCard.html
@@ -58,11 +58,11 @@
{% endif %}
-
+
{% set student_count = get_students(course.name) | length %}