Merge pull request #1568 from pateljannat/issues-114

fix: misc evaluation issues
This commit is contained in:
Jannat Patel
2025-06-10 11:06:45 +05:30
committed by GitHub
6 changed files with 29 additions and 24 deletions

View File

@@ -76,8 +76,8 @@
</Button> </Button>
</div> </div>
</div> </div>
<Tabs :tabs="tabs" v-model="tabIndex" class="border-l w-1/2"> <Tabs :tabs="tabs" as="div" v-model="tabIndex" class="border-l w-1/2">
<template #default="{ tab }"> <template #tab-panel="{ tab }">
<div <div
v-if="tab.label == 'Evaluation'" v-if="tab.label == 'Evaluation'"
class="flex flex-col space-y-4 p-5" class="flex flex-col space-y-4 p-5"

View File

@@ -5,10 +5,7 @@
{{ __('Upcoming Evaluations') }} {{ __('Upcoming Evaluations') }}
</div> </div>
<Button <Button
v-if=" v-if="upcoming_evals.data?.length != evaluationCourses.length"
!upcoming_evals.data?.length ||
upcoming_evals.length == courses.length
"
@click="openEvalModal" @click="openEvalModal"
> >
{{ __('Schedule Evaluation') }} {{ __('Schedule Evaluation') }}
@@ -118,7 +115,7 @@ import {
HeadsetIcon, HeadsetIcon,
EllipsisVertical, EllipsisVertical,
} from 'lucide-vue-next' } from 'lucide-vue-next'
import { inject, ref, getCurrentInstance } from 'vue' import { inject, ref, getCurrentInstance, computed } from 'vue'
import { formatTime } from '../utils' import { formatTime } from '../utils'
import { Button, createResource, call } from 'frappe-ui' import { Button, createResource, call } from 'frappe-ui'
import EvaluationModal from '@/components/Modals/EvaluationModal.vue' import EvaluationModal from '@/components/Modals/EvaluationModal.vue'
@@ -163,6 +160,12 @@ const openEvalCall = (evl) => {
window.open(evl.google_meet_link, '_blank') window.open(evl.google_meet_link, '_blank')
} }
const evaluationCourses = computed(() => {
return props.courses.filter((course) => {
return course.evaluator != ''
})
})
const cancelEvaluation = (evl) => { const cancelEvaluation = (evl) => {
$dialog({ $dialog({
title: __('Cancel this evaluation?'), title: __('Cancel this evaluation?'),

View File

@@ -124,7 +124,7 @@
:endDate="batch.data.end_date" :endDate="batch.data.end_date"
class="mb-3" class="mb-3"
/> />
<div class="flex items-center mb-4 text-ink-gray-7"> <div class="flex items-center mb-3 text-ink-gray-7">
<Clock class="h-4 w-4 stroke-1.5 mr-2" /> <Clock class="h-4 w-4 stroke-1.5 mr-2" />
<span> <span>
{{ formatTime(batch.data.start_time) }} - {{ formatTime(batch.data.start_time) }} -
@@ -133,7 +133,7 @@
</div> </div>
<div <div
v-if="batch.data.timezone" v-if="batch.data.timezone"
class="flex items-center mb-4 text-ink-gray-7" class="flex items-center mb-3 text-ink-gray-7"
> >
<Globe class="h-4 w-4 stroke-1.5 mr-2" /> <Globe class="h-4 w-4 stroke-1.5 mr-2" />
<span> <span>

View File

@@ -22,6 +22,7 @@
<div <div
v-if="notifications?.length" v-if="notifications?.length"
v-for="log in notifications" v-for="log in notifications"
:key="log.name"
class="flex items-center py-2 justify-between" class="flex items-center py-2 justify-between"
> >
<div class="flex items-center"> <div class="flex items-center">
@@ -32,22 +33,20 @@
<Link <Link
v-if="log.link" v-if="log.link"
:to="log.link" :to="log.link"
@click="markAsRead.submit({ name: log.name })" @click="(e) => handleMarkAsRead(e, log.name)"
class="text-ink-gray-5 font-medium text-sm hover:text-ink-gray-7" class="text-ink-gray-5 font-medium text-sm hover:text-ink-gray-7"
> >
{{ __('View') }} {{ __('View') }}
</Link> </Link>
<Tooltip :text="__('Mark as read')"> <Button
<Button variant="ghost"
variant="ghost" v-if="!log.read"
v-if="!log.read" @click.stop="(e) => handleMarkAsRead(e, log.name)"
@click="markAsRead.submit({ name: log.name })" >
> <template #icon>
<template #icon> <X class="h-4 w-4 text-ink-gray-7 stroke-1.5" />
<X class="h-4 w-4 text-ink-gray-7 stroke-1.5" /> </template>
</template> </Button>
</Button>
</Tooltip>
</div> </div>
</div> </div>
<div v-else class="text-ink-gray-5"> <div v-else class="text-ink-gray-5">
@@ -64,7 +63,6 @@ import {
Link, Link,
TabButtons, TabButtons,
Button, Button,
Tooltip,
usePageMeta, usePageMeta,
} from 'frappe-ui' } from 'frappe-ui'
import { sessionStore } from '../stores/session' import { sessionStore } from '../stores/session'
@@ -135,6 +133,10 @@ const markAllAsRead = createResource({
}, },
}) })
const handleMarkAsRead = (e, logName) => {
markAsRead.submit({ name: logName })
}
onUnmounted(() => { onUnmounted(() => {
socket.off('publish_lms_notifications') socket.off('publish_lms_notifications')
}) })

View File

@@ -58,6 +58,7 @@ const evaluations = createListResource({
doctype: 'LMS Certificate Request', doctype: 'LMS Certificate Request',
filters: { filters: {
evaluator: user.data?.name, evaluator: user.data?.name,
status: ['!=', 'Cancelled'],
}, },
fields: [ fields: [
'name', 'name',

View File

@@ -87,8 +87,7 @@ class LMSCertificateRequest(Document):
req.date == getdate(self.date) req.date == getdate(self.date)
or getdate() < getdate(req.date) or getdate() < getdate(req.date)
or ( or (
getdate() == getdate(req.date) getdate() == getdate(req.date) and get_time(nowtime()) < get_time(req.start_time)
and getdate(self.start_time) < getdate(req.start_time)
) )
): ):
course_title = frappe.db.get_value("LMS Course", req.course, "title") course_title = frappe.db.get_value("LMS Course", req.course, "title")