Merge pull request #1214 from pateljannat/issues-59
fix: progress issue in batches
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="w-full flex items-center justify-between border-b pb-4">
|
<div class="w-full flex items-center justify-between pb-4">
|
||||||
<div class="font-medium text-gray-600">
|
<div class="font-medium text-gray-600">
|
||||||
{{ __('Statistics') }}
|
{{ __('Statistics') }}
|
||||||
</div>
|
</div>
|
||||||
@@ -63,13 +63,13 @@
|
|||||||
class="flex items-center justify-center text-sm text-gray-700 space-x-4"
|
class="flex items-center justify-center text-sm text-gray-700 space-x-4"
|
||||||
>
|
>
|
||||||
<div class="flex items-center space-x-2">
|
<div class="flex items-center space-x-2">
|
||||||
<div class="w-3 h-3" style="background-color: #0289f7"></div>
|
<div class="w-3 h-3" style="background-color: #0f736b"></div>
|
||||||
<div>
|
<div>
|
||||||
{{ __('Courses') }}
|
{{ __('Courses') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center space-x-2">
|
<div class="flex items-center space-x-2">
|
||||||
<div class="w-3 h-3" style="background-color: #e03636"></div>
|
<div class="w-3 h-3" style="background-color: #0070cc"></div>
|
||||||
<div>
|
<div>
|
||||||
{{ __('Assessments') }}
|
{{ __('Assessments') }}
|
||||||
</div>
|
</div>
|
||||||
@@ -329,14 +329,14 @@ const getChartData = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getChartOptions = (categories) => {
|
const getChartOptions = (categories) => {
|
||||||
const courseColor = '#0289F7'
|
const courseColor = '#0F736B'
|
||||||
const assessmentColor = '#E03636'
|
const assessmentColor = '#0070CC'
|
||||||
const maxY = Math.ceil(students.data?.length / 10) * 10
|
const maxY = Math.ceil(students.data?.length / 10) * 10
|
||||||
|
|
||||||
return {
|
return {
|
||||||
chart: {
|
chart: {
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
height: 350,
|
height: 50,
|
||||||
toolbar: {
|
toolbar: {
|
||||||
show: false,
|
show: false,
|
||||||
},
|
},
|
||||||
@@ -345,16 +345,13 @@ const getChartOptions = (categories) => {
|
|||||||
bar: {
|
bar: {
|
||||||
distributed: true,
|
distributed: true,
|
||||||
borderRadius: 0,
|
borderRadius: 0,
|
||||||
horizontal: false,
|
horizontal: true,
|
||||||
columnWidth: '30%',
|
barHeight: '30%',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
colors: Object.values(categories).map((item) =>
|
colors: Object.values(categories).map((item) =>
|
||||||
item.type === 'course' ? courseColor : assessmentColor
|
item.type === 'course' ? courseColor : assessmentColor
|
||||||
),
|
),
|
||||||
legends: {
|
|
||||||
show: false,
|
|
||||||
},
|
|
||||||
xaxis: {
|
xaxis: {
|
||||||
categories: Object.values(categories).map((item) => item.label),
|
categories: Object.values(categories).map((item) => item.label),
|
||||||
labels: {
|
labels: {
|
||||||
@@ -363,7 +360,7 @@ const getChartOptions = (categories) => {
|
|||||||
},
|
},
|
||||||
rotate: 0,
|
rotate: 0,
|
||||||
formatter: function (value) {
|
formatter: function (value) {
|
||||||
return value.length > 22 ? `${value.substring(0, 22)}...` : value // Trim long labels
|
return value.length > 20 ? `${value.substring(0, 20)}...` : value // Trim long labels
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -87,25 +87,29 @@
|
|||||||
</span>
|
</span>
|
||||||
</Button>
|
</Button>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="mt-8 mb-4 font-medium">
|
<div class="space-y-4">
|
||||||
{{ __('This course has:') }}
|
<div class="mt-8 font-medium">
|
||||||
</div>
|
{{ __('This course has:') }}
|
||||||
<div class="flex items-center mb-3">
|
</div>
|
||||||
<BookOpen class="h-5 w-5 stroke-1.5 text-gray-600" />
|
<div class="flex items-center">
|
||||||
<span class="ml-2">
|
<BookOpen class="h-4 w-4 stroke-1.5 text-gray-600" />
|
||||||
{{ course.data.lessons }} {{ __('Lessons') }}
|
<span class="ml-2">
|
||||||
</span>
|
{{ course.data.lessons }} {{ __('Lessons') }}
|
||||||
</div>
|
</span>
|
||||||
<div class="flex items-center mb-3">
|
</div>
|
||||||
<Users class="h-5 w-5 stroke-1.5 text-gray-600" />
|
<div class="flex items-center">
|
||||||
<span class="ml-2">
|
<Users class="h-4 w-4 stroke-1.5 text-gray-600" />
|
||||||
{{ formatAmount(course.data.enrollments) }}
|
<span class="ml-2">
|
||||||
{{ __('Enrolled Students') }}
|
{{ formatAmount(course.data.enrollments) }}
|
||||||
</span>
|
{{ __('Enrolled Students') }}
|
||||||
</div>
|
</span>
|
||||||
<div class="flex items-center">
|
</div>
|
||||||
<Star class="h-5 w-5 stroke-1.5 fill-orange-500 text-gray-50" />
|
<div v-if="parseInt(course.data.rating) > 0" class="flex items-center">
|
||||||
<span class="ml-2"> {{ course.data.rating }} {{ __('Rating') }} </span>
|
<Star class="h-4 w-4 stroke-1.5 fill-orange-500 text-gray-50" />
|
||||||
|
<span class="ml-2">
|
||||||
|
{{ course.data.rating }} {{ __('Rating') }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<Tooltip
|
<Tooltip
|
||||||
v-if="course.data.rating"
|
v-if="parseInt(course.data.rating) > 0"
|
||||||
:text="__('Average Rating')"
|
:text="__('Average Rating')"
|
||||||
class="flex items-center"
|
class="flex items-center"
|
||||||
>
|
>
|
||||||
@@ -25,7 +25,9 @@
|
|||||||
{{ course.data.rating }}
|
{{ course.data.rating }}
|
||||||
</span>
|
</span>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<span v-if="course.data.rating" class="mx-3">·</span>
|
<span v-if="parseInt(course.data.rating) > 0" class="mx-3"
|
||||||
|
>·</span
|
||||||
|
>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
v-if="course.data.enrollment_count"
|
v-if="course.data.enrollment_count"
|
||||||
:text="__('Enrolled Students')"
|
:text="__('Enrolled Students')"
|
||||||
|
|||||||
@@ -1487,11 +1487,18 @@ def get_batch_students(batch):
|
|||||||
|
|
||||||
detail.courses_completed = courses_completed
|
detail.courses_completed = courses_completed
|
||||||
detail.assessments_completed = assessments_completed
|
detail.assessments_completed = assessments_completed
|
||||||
detail.progress = (
|
if len(batch_courses) + len(assessments):
|
||||||
(courses_completed + assessments_completed)
|
detail.progress = flt(
|
||||||
/ (len(batch_courses) + len(assessments))
|
(
|
||||||
* 100
|
(courses_completed + assessments_completed)
|
||||||
)
|
/ (len(batch_courses) + len(assessments))
|
||||||
|
* 100
|
||||||
|
),
|
||||||
|
2,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
detail.progress = 0
|
||||||
|
|
||||||
students.append(detail)
|
students.append(detail)
|
||||||
|
|
||||||
return students
|
return students
|
||||||
|
|||||||
Reference in New Issue
Block a user