From 25ec4ae7c6b0bb279685ea5b51e1e8906a6a4a87 Mon Sep 17 00:00:00 2001 From: Anand Chitipothu Date: Mon, 11 Oct 2021 15:08:29 +0530 Subject: [PATCH 1/8] fix: fixed the issue of lesson body getting mangled on save enabled `ignore_xss_filter` for lesson body to disable sanitizing the input. Issue #231 --- community/lms/doctype/course_lesson/course_lesson.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/community/lms/doctype/course_lesson/course_lesson.json b/community/lms/doctype/course_lesson/course_lesson.json index c154c620..68fbfc6c 100644 --- a/community/lms/doctype/course_lesson/course_lesson.json +++ b/community/lms/doctype/course_lesson/course_lesson.json @@ -56,6 +56,7 @@ { "fieldname": "body", "fieldtype": "Markdown Editor", + "ignore_xss_filter": 1, "label": "Body", "reqd": 1 }, @@ -71,7 +72,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-09-29 15:28:51.418015", + "modified": "2021-10-11 15:07:38.134809", "modified_by": "Administrator", "module": "LMS", "name": "Course Lesson", From c91b1a7a235b6da8963d50ecb7b89c9d542ac0eb Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Tue, 12 Oct 2021 10:34:15 +0530 Subject: [PATCH 2/8] fix: quiz question length issue --- community/lms/doctype/lms_quiz_result/lms_quiz_result.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/community/lms/doctype/lms_quiz_result/lms_quiz_result.json b/community/lms/doctype/lms_quiz_result/lms_quiz_result.json index 255b8a9a..113f0612 100644 --- a/community/lms/doctype/lms_quiz_result/lms_quiz_result.json +++ b/community/lms/doctype/lms_quiz_result/lms_quiz_result.json @@ -12,7 +12,7 @@ "fields": [ { "fieldname": "question", - "fieldtype": "Data", + "fieldtype": "Text", "in_list_view": 1, "label": "Question" }, @@ -33,7 +33,7 @@ "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2021-06-22 18:32:28.813159", + "modified": "2021-10-12 10:32:45.139121", "modified_by": "Administrator", "module": "LMS", "name": "LMS Quiz Result", From 8fe9bad2bb83947348861bddf924ff75cfb6cb4c Mon Sep 17 00:00:00 2001 From: Anand Chitipothu Date: Tue, 12 Oct 2021 12:38:26 +0530 Subject: [PATCH 3/8] fix: error on reindex-exercises Issue fossunited/mon_school#69 --- community/lms/doctype/lms_course/lms_course.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/community/lms/doctype/lms_course/lms_course.py b/community/lms/doctype/lms_course/lms_course.py index 5a60f38c..feebe8f3 100644 --- a/community/lms/doctype/lms_course/lms_course.py +++ b/community/lms/doctype/lms_course/lms_course.py @@ -225,17 +225,14 @@ class LMSCourse(Document): def reindex_exercises(self): for i, c in enumerate(self.get_chapters(), start=1): - if c.index_ != i: - c.index_ = i - c.save() - self._reindex_exercises_in_chapter(c) + self._reindex_exercises_in_chapter(c, i) - def _reindex_exercises_in_chapter(self, c): + def _reindex_exercises_in_chapter(self, c, index): i = 1 for lesson in self.get_lessons(c): for exercise in lesson.get_exercises(): exercise.index_ = i - exercise.index_label = f"{c.index_}.{i}" + exercise.index_label = f"{index}.{i}" exercise.save() i += 1 From bf986e26bcb16e399e406b1ce1ebda8e571a66c5 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 18 Oct 2021 12:24:37 +0530 Subject: [PATCH 4/8] fix: rating issue --- community/lms/widgets/CourseCard.html | 2 +- community/www/courses/course.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/community/lms/widgets/CourseCard.html b/community/lms/widgets/CourseCard.html index 43fe45e9..4de60d41 100644 --- a/community/lms/widgets/CourseCard.html +++ b/community/lms/widgets/CourseCard.html @@ -57,7 +57,7 @@ {% if avg_rating %} - {{ avg_rating }} + {{ frappe.utils.flt(avg_rating, frappe.get_system_settings('float_precision') or 3) }} {% endif %} diff --git a/community/www/courses/course.html b/community/www/courses/course.html index 645978a5..67e22327 100644 --- a/community/www/courses/course.html +++ b/community/www/courses/course.html @@ -201,7 +201,7 @@ {% if avg_rating %}
- {{ avg_rating }} Rating + {{ frappe.utils.flt(avg_rating, frappe.get_system_settings('float_precision') or 3) }} Rating
{% endif %} From 8090f2f3970084061c72297edc93ea0e968cf9a5 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 18 Oct 2021 12:43:34 +0530 Subject: [PATCH 5/8] fix: made strings translatable --- community/lms/widgets/CourseCard.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/community/lms/widgets/CourseCard.html b/community/lms/widgets/CourseCard.html index 4de60d41..9ba8f5d2 100644 --- a/community/lms/widgets/CourseCard.html +++ b/community/lms/widgets/CourseCard.html @@ -10,9 +10,9 @@ {% endfor %} {% if membership and not read_only %} {% if progress < 100 %} -  
{{ frappe.utils.rounded(progress) }}% Completed
+  
{{ frappe.utils.rounded(progress) }}% _("Completed")
{% else %} -
Completed
+
_("Completed")
{% endif %} {% endif %} @@ -25,7 +25,7 @@
{% if course.get_chapters() | length %} - {{ course.get_chapters() | length }} Chapters + {{ course.get_chapters() | length }} _("Chapters") {% endif %} {% if course.get_chapters() | length and course.get_upcoming_batches() | length %} @@ -33,7 +33,7 @@ {% endif %} {% if course.get_upcoming_batches() | length %} - {{ course.get_upcoming_batches() | length }} Open Batches + {{ course.get_upcoming_batches() | length }} _("Open Batches") {% endif %}
@@ -75,36 +75,36 @@ {% if certificate %} {% elif course.enable_certification and progress == 100 %} {% elif progress == 100 %} {% elif course.upcoming %} {% elif membership %} {% else %} From 7d80178b48026bf3505362d2706dd79f9ede83d3 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 18 Oct 2021 13:02:11 +0530 Subject: [PATCH 6/8] fix: allow import on course chapter lesson quiz --- community/lms/doctype/course_chapter/course_chapter.json | 3 ++- community/lms/doctype/course_lesson/course_lesson.json | 3 ++- community/lms/doctype/lms_course/lms_course.json | 3 ++- community/lms/doctype/lms_quiz/lms_quiz.json | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/community/lms/doctype/course_chapter/course_chapter.json b/community/lms/doctype/course_chapter/course_chapter.json index 7ebf90b4..7dca741a 100644 --- a/community/lms/doctype/course_chapter/course_chapter.json +++ b/community/lms/doctype/course_chapter/course_chapter.json @@ -1,5 +1,6 @@ { "actions": [], + "allow_import": 1, "allow_rename": 1, "autoname": "format:{####} {title}", "creation": "2021-05-03 05:49:08.383058", @@ -58,7 +59,7 @@ "link_fieldname": "chapter" } ], - "modified": "2021-09-29 15:33:44.611228", + "modified": "2021-09-29 15:33:44.611229", "modified_by": "Administrator", "module": "LMS", "name": "Course Chapter", diff --git a/community/lms/doctype/course_lesson/course_lesson.json b/community/lms/doctype/course_lesson/course_lesson.json index 68fbfc6c..d63eb69b 100644 --- a/community/lms/doctype/course_lesson/course_lesson.json +++ b/community/lms/doctype/course_lesson/course_lesson.json @@ -1,5 +1,6 @@ { "actions": [], + "allow_import": 1, "allow_rename": 1, "autoname": "format:{####} {title}", "creation": "2021-05-03 06:21:12.995984", @@ -72,7 +73,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-10-11 15:07:38.134809", + "modified": "2021-10-11 15:07:38.134808", "modified_by": "Administrator", "module": "LMS", "name": "Course Lesson", diff --git a/community/lms/doctype/lms_course/lms_course.json b/community/lms/doctype/lms_course/lms_course.json index d2718857..dd5d9fab 100644 --- a/community/lms/doctype/lms_course/lms_course.json +++ b/community/lms/doctype/lms_course/lms_course.json @@ -8,6 +8,7 @@ } ], "allow_guest_to_view": 1, + "allow_import": 1, "allow_rename": 1, "creation": "2021-03-01 16:49:33.622422", "doctype": "DocType", @@ -167,7 +168,7 @@ "link_fieldname": "course" } ], - "modified": "2021-09-30 10:36:48.759994", + "modified": "2021-09-30 10:36:48.759995", "modified_by": "Administrator", "module": "LMS", "name": "LMS Course", diff --git a/community/lms/doctype/lms_quiz/lms_quiz.json b/community/lms/doctype/lms_quiz/lms_quiz.json index 837e8ead..129291a4 100644 --- a/community/lms/doctype/lms_quiz/lms_quiz.json +++ b/community/lms/doctype/lms_quiz/lms_quiz.json @@ -1,5 +1,6 @@ { "actions": [], + "allow_import": 1, "allow_rename": 1, "autoname": "field:title", "creation": "2021-06-07 10:50:17.893625", @@ -34,7 +35,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-09-30 13:10:06.929357", + "modified": "2021-09-30 13:10:06.929358", "modified_by": "Administrator", "module": "LMS", "name": "LMS Quiz", From eaa8876f4e8dcf8d3fa7e330c7d46de4a0ecb708 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 18 Oct 2021 13:13:19 +0530 Subject: [PATCH 7/8] fix: made quotes same throughout file --- community/lms/widgets/CourseCard.html | 2 +- community/www/courses/course.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/community/lms/widgets/CourseCard.html b/community/lms/widgets/CourseCard.html index 9ba8f5d2..0ae258c9 100644 --- a/community/lms/widgets/CourseCard.html +++ b/community/lms/widgets/CourseCard.html @@ -57,7 +57,7 @@ {% if avg_rating %} - {{ frappe.utils.flt(avg_rating, frappe.get_system_settings('float_precision') or 3) }} + {{ frappe.utils.flt(avg_rating, frappe.get_system_settings("float_precision") or 3) }} {% endif %} diff --git a/community/www/courses/course.html b/community/www/courses/course.html index 67e22327..9bb06343 100644 --- a/community/www/courses/course.html +++ b/community/www/courses/course.html @@ -201,7 +201,7 @@ {% if avg_rating %}
- {{ frappe.utils.flt(avg_rating, frappe.get_system_settings('float_precision') or 3) }} Rating + {{ frappe.utils.flt(avg_rating, frappe.get_system_settings("float_precision") or 3) }} Rating
{% endif %} From 91ebcd825347f9fad318db3f5f2146167387293f Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 18 Oct 2021 13:28:48 +0530 Subject: [PATCH 8/8] fix: translation issue --- community/lms/widgets/CourseCard.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/community/lms/widgets/CourseCard.html b/community/lms/widgets/CourseCard.html index 0ae258c9..38736ab0 100644 --- a/community/lms/widgets/CourseCard.html +++ b/community/lms/widgets/CourseCard.html @@ -10,9 +10,9 @@ {% endfor %} {% if membership and not read_only %} {% if progress < 100 %} -  
{{ frappe.utils.rounded(progress) }}% _("Completed")
+  
{{ frappe.utils.rounded(progress) }}% {{ _("Completed") }}
{% else %} -
_("Completed")
+
{{ _("Completed") }}
{% endif %} {% endif %} @@ -25,7 +25,7 @@
{% if course.get_chapters() | length %} - {{ course.get_chapters() | length }} _("Chapters") + {{ course.get_chapters() | length }} {{ _("Chapters") }} {% endif %} {% if course.get_chapters() | length and course.get_upcoming_batches() | length %} @@ -33,7 +33,7 @@ {% endif %} {% if course.get_upcoming_batches() | length %} - {{ course.get_upcoming_batches() | length }} _("Open Batches") + {{ course.get_upcoming_batches() | length }} {{ _("Open Batches") }} {% endif %}
@@ -81,30 +81,30 @@ {% elif course.enable_certification and progress == 100 %} {% elif progress == 100 %} {% elif course.upcoming %} {% elif membership %} {% else %}