@@ -109,7 +109,7 @@ import BaseButton from '@/components/BaseButton.vue'
|
||||
import SvgIcon from '@/components/icons/SvgIcon.vue'
|
||||
import NoItems from '@/components/blocks/NoItems.vue'
|
||||
import { formatJalaaliDate } from '@/utils/date-utils'
|
||||
import { useAdminExamParticipantQuery } from '@/services/query/admin-exams'
|
||||
import { useAdminExamAttemptQuery } from '@/services/query/admin-exams'
|
||||
import SkeletonLoaderBlock from '@/components/blocks/SkeletonLoaderBlock.vue'
|
||||
|
||||
defineOptions({ name: 'ExamParticipantDetailsModal' })
|
||||
@@ -125,16 +125,18 @@ const TONE_MAP = {
|
||||
const { getModal } = useModal()
|
||||
|
||||
const modalData = computed(() => getModal('ExamParticipantDetailsModal')?.data ?? {})
|
||||
const examId = computed(() => modalData.value.examId ?? null)
|
||||
const participantId = computed(() => modalData.value.participantId ?? null)
|
||||
const attemptId = computed(() => modalData.value.attemptId ?? null)
|
||||
const participant = computed(() => modalData.value.participant ?? null)
|
||||
|
||||
const { data: detail, isLoading } = useAdminExamParticipantQuery(examId, participantId, {
|
||||
enabled: () => !!examId.value && !!participantId.value,
|
||||
const { data: detail, isLoading } = useAdminExamAttemptQuery(attemptId, {
|
||||
enabled: () => !!attemptId.value,
|
||||
})
|
||||
|
||||
const rawAttempts = computed(
|
||||
() => detail.value?.attempts || detail.value?.data?.attempts || participant.value?.attempts || []
|
||||
// The review endpoint returns one attempt; the template renders an accordion
|
||||
// list, so wrap it as a single-element list (falling back to any attempts that
|
||||
// were passed through on the modal data).
|
||||
const rawAttempts = computed(() =>
|
||||
detail.value ? [detail.value] : participant.value?.attempts || []
|
||||
)
|
||||
|
||||
const attempts = computed(() =>
|
||||
|
||||
@@ -130,6 +130,7 @@ const onShowDetails = (attempt) => {
|
||||
const u = userOf(attempt)
|
||||
openModal('ExamParticipantDetailsModal', {
|
||||
examId: examId.value,
|
||||
attemptId: attempt.id,
|
||||
participantId: u.id,
|
||||
participant: {
|
||||
id: u.id,
|
||||
|
||||
Reference in New Issue
Block a user