fix: 修复学生回答显示问题,和排序
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
This commit is contained in:
parent
dd12737ee4
commit
4fd36aedf1
@ -43,6 +43,7 @@ const rows = computed(() => {
|
||||
titleId: item?.titleId ?? '',
|
||||
correctNum: correct,
|
||||
errorNum: error,
|
||||
correctRate: Number.isFinite(rate) ? rate : 0,
|
||||
correctRateText: `${(rate * 100).toFixed(0)}%`,
|
||||
unSubmitNum: unSubmit,
|
||||
}
|
||||
@ -139,6 +140,10 @@ watch(
|
||||
function getTitleKey(item: any) {
|
||||
return item.xkwTitle?.titleId ?? item.titleId ?? item.xkwTitle?.id ?? item.id
|
||||
}
|
||||
|
||||
function sortByCorrectRate(a: any, b: any) {
|
||||
return Number(a?.correctRate ?? 0) - Number(b?.correctRate ?? 0)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -198,6 +203,7 @@ function getTitleKey(item: any) {
|
||||
label="得分率"
|
||||
class-name="pointer-cell"
|
||||
sortable
|
||||
:sort-method="sortByCorrectRate"
|
||||
header-align="center"
|
||||
align="center"
|
||||
>
|
||||
|
||||
@ -54,8 +54,18 @@ type StudentPerformanceLevel =
|
||||
| 'fail'
|
||||
| 'default'
|
||||
|
||||
function hasAnyAnswer(item: any): boolean {
|
||||
const answer = item?.submitAnswer
|
||||
const hasText =
|
||||
typeof answer === 'string' ? Boolean(answer.trim()) : Boolean(answer)
|
||||
const pics = item?.submitAnswerPic
|
||||
const hasPics = typeof pics === 'string' ? Boolean(pics.trim()) : Boolean(pics)
|
||||
return hasText || hasPics
|
||||
}
|
||||
|
||||
function resolvePerformanceLevel(item: any): StudentPerformanceLevel {
|
||||
if (item.status === 0) return 'unsubmitted'
|
||||
// 约定:学生只要上传了作答图片,也视为已作答(不算未提交)
|
||||
if (item.status === 0 && !hasAnyAnswer(item)) return 'unsubmitted'
|
||||
if (item.gradingStatus === 0) return 'ungraded'
|
||||
|
||||
const level = Number(item?.level ?? item?.scoreLevel ?? 0)
|
||||
@ -72,6 +82,14 @@ function resolvePerformanceLevel(item: any): StudentPerformanceLevel {
|
||||
return 'default'
|
||||
}
|
||||
|
||||
function getSubmitAnswerText(item: any): string {
|
||||
const answer = item?.submitAnswer
|
||||
if (typeof answer === 'string' && answer.trim()) return answer
|
||||
if (answer != null && String(answer).trim()) return String(answer)
|
||||
if (item?.submitAnswerPic) return '(已上传图片作答)'
|
||||
return '未作答'
|
||||
}
|
||||
|
||||
function getGradingStatusText(item: any) {
|
||||
const performanceLevel = resolvePerformanceLevel(item)
|
||||
if (performanceLevel === 'unsubmitted') return '未提交'
|
||||
@ -578,7 +596,7 @@ async function submitCorrection() {
|
||||
<template v-if="!isSubjectiveItem(item)">
|
||||
<div class="student-answer">
|
||||
<span class="label">学生答案:</span>
|
||||
<span class="content">{{ item.submitAnswer || '-' }}</span>
|
||||
<span class="content">{{ getSubmitAnswerText(item) }}</span>
|
||||
</div>
|
||||
<div class="system-mark">
|
||||
<span class="label">系统批改结果:</span>
|
||||
@ -611,7 +629,7 @@ async function submitCorrection() {
|
||||
class="answer-body"
|
||||
v-html="
|
||||
highlightKeywords(
|
||||
formatParagraphs(item.submitAnswer || '未作答'),
|
||||
formatParagraphs(getSubmitAnswerText(item)),
|
||||
getAiKeywords(item),
|
||||
)
|
||||
"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user