From 8640ecf9be7512543dc9b79e5c9ec58b77482fb2 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Wed, 30 Oct 2024 22:12:59 +0530 Subject: [PATCH] refactor: course list data --- frontend/src/components/CourseCard.vue | 12 +-- frontend/src/components/CourseCardOverlay.vue | 10 +- frontend/src/components/CourseReviews.vue | 2 +- frontend/src/components/LessonHelp.vue | 6 +- frontend/src/pages/BatchForm.vue | 86 ++++++++-------- frontend/src/pages/Batches.vue | 74 +++++++++++--- frontend/src/pages/CourseDetail.vue | 10 +- frontend/src/pages/CourseForm.vue | 44 ++++----- frontend/src/pages/Courses.vue | 98 +++++++++++-------- frontend/src/pages/Lesson.vue | 4 +- frontend/src/utils/index.js | 9 ++ lms/hooks.py | 3 +- lms/lms/api.py | 23 ++++- lms/lms/doctype/lms_course/lms_course.json | 36 ++++++- .../lms_enrollment/lms_enrollment.json | 5 +- lms/lms/utils.py | 35 +++---- lms/patches.txt | 3 +- lms/patches/v2_0/add_course_statistics.py | 6 ++ 18 files changed, 299 insertions(+), 167 deletions(-) create mode 100644 lms/patches/v2_0/add_course_statistics.py diff --git a/frontend/src/components/CourseCard.vue b/frontend/src/components/CourseCard.vue index b5e84e3c..0a751668 100644 --- a/frontend/src/components/CourseCard.vue +++ b/frontend/src/components/CourseCard.vue @@ -30,29 +30,29 @@
-
+
- {{ course.lesson_count }} + {{ course.lessons }}
-
+
- {{ course.enrollment_count }} + {{ course.enrollments }}
-
+
- {{ course.avg_rating }} + {{ course.rating }}
diff --git a/frontend/src/components/CourseCardOverlay.vue b/frontend/src/components/CourseCardOverlay.vue index ea8d4409..24f5c5b3 100644 --- a/frontend/src/components/CourseCardOverlay.vue +++ b/frontend/src/components/CourseCardOverlay.vue @@ -93,21 +93,19 @@
- {{ course.data.lesson_count }} {{ __('Lessons') }} + {{ course.data.lessons }} {{ __('Lessons') }}
- {{ course.data.enrollment_count_formatted }} + {{ formatAmount(course.data.enrollments) }} {{ __('Enrolled Students') }}
- - {{ course.data.avg_rating }} {{ __('Rating') }} - + {{ course.data.rating }} {{ __('Rating') }}
@@ -116,7 +114,7 @@ import { BookOpen, Users, Star } from 'lucide-vue-next' import { computed, inject } from 'vue' import { Button, createResource } from 'frappe-ui' -import { showToast } from '@/utils/' +import { showToast, formatAmount } from '@/utils/' import { capture } from '@/telemetry' import { useRouter } from 'vue-router' diff --git a/frontend/src/components/CourseReviews.vue b/frontend/src/components/CourseReviews.vue index 2537531a..85b380ae 100644 --- a/frontend/src/components/CourseReviews.vue +++ b/frontend/src/components/CourseReviews.vue @@ -76,7 +76,7 @@ const props = defineProps({ required: true, }, avg_rating: { - type: Number, + type: String, required: true, }, membership: { diff --git a/frontend/src/components/LessonHelp.vue b/frontend/src/components/LessonHelp.vue index 6be6a895..ce84f3e0 100644 --- a/frontend/src/components/LessonHelp.vue +++ b/frontend/src/components/LessonHelp.vue @@ -21,7 +21,7 @@
@@ -58,9 +58,7 @@
-
+
{{ __('What does include in preview mean?') }} diff --git a/frontend/src/pages/BatchForm.vue b/frontend/src/pages/BatchForm.vue index 01ce923c..b6da6785 100644 --- a/frontend/src/pages/BatchForm.vue +++ b/frontend/src/pages/BatchForm.vue @@ -32,50 +32,52 @@
-
- - - -
-
- {{ __('Meta Image') }} -
+
+ {{ __('Meta Image') }} +
+ + + +
+
+ +
+ +
+ {{ + __( + 'Appears when the batch URL is shared on any online platform' + ) + }}
-
-
@@ -149,6 +153,7 @@ :label="__('Seat Count')" type="number" class="mb-4" + :placeholder="__('Number of seats available')" />
-
-
-
- {{ __('No {0} batches found').format(tab.label.toLowerCase()) }} -
-
+
+ {{ __('No {0} batches').format(tab.label.toLowerCase()) }}
+
+ +
+
+ +
+ {{ __('Create a Batch') }} +
+ + {{ __('You can link courses and assessments to it.') }} + +
+
+
+
+
+ +
+ {{ __('No batches found') }} +
+
+ {{ + __( + 'There are no batches available at the moment. Keep an eye out, fresh learning experiences are on the way soon!' + ) + }} +
+