From e45b33a8099cf1f742ba3a7c742628bf61ed6d3c Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Wed, 8 Jan 2025 11:22:07 +0530 Subject: [PATCH 1/3] feat: batch feedback --- frontend/src/components/BatchFeedback.vue | 47 ++++++++++ frontend/src/components/BatchStudents.vue | 2 +- .../Modals/BatchStudentProgress.vue | 4 - frontend/src/pages/Batch.vue | 14 ++- lms/lms/api.py | 2 +- .../doctype/lms_batch_feedback/__init__.py | 0 .../lms_batch_feedback/lms_batch_feedback.js | 8 ++ .../lms_batch_feedback.json | 90 +++++++++++++++++++ .../lms_batch_feedback/lms_batch_feedback.py | 9 ++ .../test_lms_batch_feedback.py | 30 +++++++ 10 files changed, 198 insertions(+), 8 deletions(-) create mode 100644 frontend/src/components/BatchFeedback.vue create mode 100644 lms/lms/doctype/lms_batch_feedback/__init__.py create mode 100644 lms/lms/doctype/lms_batch_feedback/lms_batch_feedback.js create mode 100644 lms/lms/doctype/lms_batch_feedback/lms_batch_feedback.json create mode 100644 lms/lms/doctype/lms_batch_feedback/lms_batch_feedback.py create mode 100644 lms/lms/doctype/lms_batch_feedback/test_lms_batch_feedback.py diff --git a/frontend/src/components/BatchFeedback.vue b/frontend/src/components/BatchFeedback.vue new file mode 100644 index 000000000..94d454476 --- /dev/null +++ b/frontend/src/components/BatchFeedback.vue @@ -0,0 +1,47 @@ + + diff --git a/frontend/src/components/BatchStudents.vue b/frontend/src/components/BatchStudents.vue index 8a6d520a9..11a4cb745 100644 --- a/frontend/src/components/BatchStudents.vue +++ b/frontend/src/components/BatchStudents.vue @@ -391,7 +391,7 @@ const getChartOptions = (categories) => { }, rotate: 0, formatter: function (value) { - return value.length > 20 ? `${value.substring(0, 20)}...` : value // Trim long labels + return value.length > 20 ? `${value.substring(0, 20)}...` : value }, }, }, diff --git a/frontend/src/components/Modals/BatchStudentProgress.vue b/frontend/src/components/Modals/BatchStudentProgress.vue index 6e7266659..9c40c2aa0 100644 --- a/frontend/src/components/Modals/BatchStudentProgress.vue +++ b/frontend/src/components/Modals/BatchStudentProgress.vue @@ -77,10 +77,6 @@ - - diff --git a/frontend/src/pages/Batch.vue b/frontend/src/pages/Batch.vue index 511e4b2e3..86e7cff0b 100644 --- a/frontend/src/pages/Batch.vue +++ b/frontend/src/pages/Batch.vue @@ -84,6 +84,9 @@ :scrollToBottom="true" /> +
+ +
@@ -190,12 +193,11 @@ import { BookOpen, Laptop, BookOpenCheck, - Contact2, Mail, SendIcon, MessageCircle, Globe, - ShieldCheck, + ClipboardPen, } from 'lucide-vue-next' import { formatTime, updateDocumentTitle } from '@/utils' import BatchDashboard from '@/components/BatchDashboard.vue' @@ -208,6 +210,7 @@ import AnnouncementModal from '@/components/Modals/AnnouncementModal.vue' import Discussions from '@/components/Discussions.vue' import DateRange from '@/components/Common/DateRange.vue' import BulkCertificates from '@/components/Modals/BulkCertificates.vue' +import BatchFeedback from '@/components/BatchFeedback.vue' const user = inject('$user') const showAnnouncementModal = ref(false) @@ -291,6 +294,13 @@ const tabs = computed(() => { label: 'Discussions', icon: MessageCircle, }) + + if (isStudent.value) { + batchTabs.push({ + label: 'Feedback', + icon: ClipboardPen, + }) + } return batchTabs }) diff --git a/lms/lms/api.py b/lms/lms/api.py index 347e3ac1f..8f7ee3fb2 100644 --- a/lms/lms/api.py +++ b/lms/lms/api.py @@ -594,7 +594,7 @@ def get_categories(doctype, filters): def get_members(start=0, search=""): """Get members for the given search term and start index. Args: start (int): Start index for the query. - search (str): Search term to filter the results. + search (str): Search term to filter the results. Returns: List of members. """ diff --git a/lms/lms/doctype/lms_batch_feedback/__init__.py b/lms/lms/doctype/lms_batch_feedback/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/lms/lms/doctype/lms_batch_feedback/lms_batch_feedback.js b/lms/lms/doctype/lms_batch_feedback/lms_batch_feedback.js new file mode 100644 index 000000000..fec296c0e --- /dev/null +++ b/lms/lms/doctype/lms_batch_feedback/lms_batch_feedback.js @@ -0,0 +1,8 @@ +// Copyright (c) 2025, Frappe and contributors +// For license information, please see license.txt + +// frappe.ui.form.on("LMS Batch Feedback", { +// refresh(frm) { + +// }, +// }); diff --git a/lms/lms/doctype/lms_batch_feedback/lms_batch_feedback.json b/lms/lms/doctype/lms_batch_feedback/lms_batch_feedback.json new file mode 100644 index 000000000..4609fc2f3 --- /dev/null +++ b/lms/lms/doctype/lms_batch_feedback/lms_batch_feedback.json @@ -0,0 +1,90 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2025-01-07 18:53:22.279844", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "member", + "batch", + "feedback", + "column_break_swst", + "content", + "delivery", + "instructors", + "value" + ], + "fields": [ + { + "fieldname": "member", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Member", + "options": "User", + "reqd": 1 + }, + { + "fieldname": "batch", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Batch", + "options": "LMS Batch", + "reqd": 1 + }, + { + "fieldname": "feedback", + "fieldtype": "Small Text", + "in_list_view": 1, + "label": "Feedback", + "reqd": 1 + }, + { + "fieldname": "column_break_swst", + "fieldtype": "Column Break" + }, + { + "fieldname": "content", + "fieldtype": "Rating", + "label": "Content" + }, + { + "fieldname": "delivery", + "fieldtype": "Rating", + "label": "Delivery" + }, + { + "fieldname": "instructors", + "fieldtype": "Rating", + "label": "Instructors" + }, + { + "fieldname": "value", + "fieldtype": "Rating", + "label": "Value" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2025-01-07 18:56:38.800575", + "modified_by": "Administrator", + "module": "LMS", + "name": "LMS Batch Feedback", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "sort_field": "creation", + "sort_order": "DESC", + "states": [] +} \ No newline at end of file diff --git a/lms/lms/doctype/lms_batch_feedback/lms_batch_feedback.py b/lms/lms/doctype/lms_batch_feedback/lms_batch_feedback.py new file mode 100644 index 000000000..43a049f3f --- /dev/null +++ b/lms/lms/doctype/lms_batch_feedback/lms_batch_feedback.py @@ -0,0 +1,9 @@ +# Copyright (c) 2025, Frappe and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + + +class LMSBatchFeedback(Document): + pass diff --git a/lms/lms/doctype/lms_batch_feedback/test_lms_batch_feedback.py b/lms/lms/doctype/lms_batch_feedback/test_lms_batch_feedback.py new file mode 100644 index 000000000..38b10c4fd --- /dev/null +++ b/lms/lms/doctype/lms_batch_feedback/test_lms_batch_feedback.py @@ -0,0 +1,30 @@ +# Copyright (c) 2025, Frappe and Contributors +# See license.txt + +# import frappe +from frappe.tests import IntegrationTestCase, UnitTestCase + + +# On IntegrationTestCase, the doctype test records and all +# link-field test record dependencies are recursively loaded +# Use these module variables to add/remove to/from that list +EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] +IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] + + +class UnitTestLMSBatchFeedback(UnitTestCase): + """ + Unit tests for LMSBatchFeedback. + Use this class for testing individual functions and methods. + """ + + pass + + +class IntegrationTestLMSBatchFeedback(IntegrationTestCase): + """ + Integration tests for LMSBatchFeedback. + Use this class for testing interactions between multiple components. + """ + + pass From 2ecb93e925f692bf9f2313c0693e79fb4f7f16a2 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Fri, 10 Jan 2025 19:05:59 +0530 Subject: [PATCH 2/3] feat: show submitted feedback as readonly --- frontend/src/components/BatchFeedback.vue | 94 +++++++++++++++---- frontend/src/components/JobCard.vue | 2 +- .../lms_batch_feedback.json | 14 ++- 3 files changed, 92 insertions(+), 18 deletions(-) diff --git a/frontend/src/components/BatchFeedback.vue b/frontend/src/components/BatchFeedback.vue index 94d454476..93eca9e66 100644 --- a/frontend/src/components/BatchFeedback.vue +++ b/frontend/src/components/BatchFeedback.vue @@ -1,25 +1,59 @@ - diff --git a/frontend/src/components/JobCard.vue b/frontend/src/components/JobCard.vue index e59978f8b..a67e69cf2 100644 --- a/frontend/src/components/JobCard.vue +++ b/frontend/src/components/JobCard.vue @@ -1,5 +1,5 @@