score
This commit is contained in:
@@ -292,15 +292,35 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="!showFeedback" class="flex flex-col sm:flex-row justify-center items-center gap-3 w-full">
|
<div v-if="!showFeedback" class="flex flex-col sm:flex-row justify-center items-center gap-3 w-full">
|
||||||
<button
|
<template v-if="hasStoredCorrectAnswer">
|
||||||
@click="submitDescriptiveGrading"
|
<button
|
||||||
:disabled="!userDescriptiveAnswer.trim() || gradingDescriptive"
|
@click="submitDescriptiveNormalGrading"
|
||||||
class="btn btn-primary btn-md sm:btn-lg w-full sm:w-auto sm:flex-1 shadow-md gap-2 text-sm sm:text-base whitespace-normal break-keep"
|
:disabled="!userDescriptiveAnswer.trim() || gradingDescriptive"
|
||||||
>
|
class="btn btn-primary btn-md sm:btn-lg w-full sm:w-auto sm:flex-1 shadow-md text-sm sm:text-base whitespace-normal break-keep"
|
||||||
<span v-if="gradingDescriptive" class="loading loading-spinner loading-sm"></span>
|
>
|
||||||
<SparklesIcon v-else :size="18" />
|
일반 채점
|
||||||
{{ gradingDescriptive ? 'AI 채점 진행중...' : 'AI 채점 요청하기' }}
|
</button>
|
||||||
</button>
|
<button
|
||||||
|
@click="submitDescriptiveGrading"
|
||||||
|
:disabled="!userDescriptiveAnswer.trim() || gradingDescriptive"
|
||||||
|
class="btn btn-secondary btn-md sm:btn-lg w-full sm:w-auto sm:flex-1 shadow-md gap-2 text-sm sm:text-base whitespace-normal break-keep"
|
||||||
|
>
|
||||||
|
<span v-if="gradingDescriptive" class="loading loading-spinner loading-sm"></span>
|
||||||
|
<SparklesIcon v-else :size="16" />
|
||||||
|
{{ gradingDescriptive ? 'AI 채점중...' : 'AI 채점' }}
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<button
|
||||||
|
@click="submitDescriptiveGrading"
|
||||||
|
:disabled="!userDescriptiveAnswer.trim() || gradingDescriptive"
|
||||||
|
class="btn btn-primary btn-md sm:btn-lg w-full sm:w-auto sm:flex-1 shadow-md gap-2 text-sm sm:text-base whitespace-normal break-keep"
|
||||||
|
>
|
||||||
|
<span v-if="gradingDescriptive" class="loading loading-spinner loading-sm"></span>
|
||||||
|
<SparklesIcon v-else :size="18" />
|
||||||
|
{{ gradingDescriptive ? 'AI 채점 진행중...' : 'AI 채점 요청하기' }}
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
<button
|
<button
|
||||||
@click="skipToExplanations"
|
@click="skipToExplanations"
|
||||||
:disabled="gradingDescriptive"
|
:disabled="gradingDescriptive"
|
||||||
@@ -369,7 +389,7 @@
|
|||||||
|
|
||||||
<!-- Feedback & Explanations -->
|
<!-- Feedback & Explanations -->
|
||||||
<div v-if="showFeedback" class="bg-base-300/80 border-t border-base-300 p-5 sm:p-6 md:p-8">
|
<div v-if="showFeedback" class="bg-base-300/80 border-t border-base-300 p-5 sm:p-6 md:p-8">
|
||||||
<div v-if="!isDescriptiveQuestion" class="alert shadow-lg mb-6" :class="isCorrect ? 'alert-success' : 'alert-error'">
|
<div v-if="!isDescriptiveQuestion || usedDescriptiveNormalGrading" class="alert shadow-lg mb-6" :class="isCorrect ? 'alert-success' : 'alert-error'">
|
||||||
<CheckCircleIcon v-if="isCorrect" :size="24" />
|
<CheckCircleIcon v-if="isCorrect" :size="24" />
|
||||||
<XCircleIcon v-else :size="24" />
|
<XCircleIcon v-else :size="24" />
|
||||||
<div>
|
<div>
|
||||||
@@ -639,6 +659,7 @@ const userDescriptiveAnswer = ref('')
|
|||||||
const descriptiveGradingResult = ref<DescriptiveGradingRecord | null>(null)
|
const descriptiveGradingResult = ref<DescriptiveGradingRecord | null>(null)
|
||||||
const descriptiveHistory = ref<DescriptiveGradingRecord[]>([])
|
const descriptiveHistory = ref<DescriptiveGradingRecord[]>([])
|
||||||
const gradingError = ref('')
|
const gradingError = ref('')
|
||||||
|
const usedDescriptiveNormalGrading = ref(false)
|
||||||
|
|
||||||
// OCR state
|
// OCR state
|
||||||
const ocrFileInput = ref<HTMLInputElement | null>(null)
|
const ocrFileInput = ref<HTMLInputElement | null>(null)
|
||||||
@@ -807,6 +828,26 @@ function submitTextAnswerWithAi() {
|
|||||||
submitDescriptiveGrading()
|
submitDescriptiveGrading()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function submitDescriptiveNormalGrading() {
|
||||||
|
if (showFeedback.value || !userDescriptiveAnswer.value.trim()) return
|
||||||
|
|
||||||
|
const userClean = userDescriptiveAnswer.value.trim().replace(/\s+/g, '').toLowerCase()
|
||||||
|
const correctAnswers = (currentQuestion.value.correctAnswerStr || '')
|
||||||
|
.split(';;')
|
||||||
|
.map(ans => ans.trim().replace(/\s+/g, '').toLowerCase())
|
||||||
|
|
||||||
|
isCorrect.value = correctAnswers.includes(userClean)
|
||||||
|
|
||||||
|
const key = `${currentQuestion.value.source}_${currentQuestion.value.id}`
|
||||||
|
if (isCorrect.value && !scoredQuestions.value[key]) {
|
||||||
|
scoredQuestions.value[key] = true
|
||||||
|
score.value++
|
||||||
|
}
|
||||||
|
|
||||||
|
usedDescriptiveNormalGrading.value = true
|
||||||
|
showFeedback.value = true
|
||||||
|
}
|
||||||
|
|
||||||
async function submitDescriptiveGrading() {
|
async function submitDescriptiveGrading() {
|
||||||
const q = currentQuestion.value
|
const q = currentQuestion.value
|
||||||
if (!q || !userDescriptiveAnswer.value.trim() || gradingDescriptive.value) return
|
if (!q || !userDescriptiveAnswer.value.trim() || gradingDescriptive.value) return
|
||||||
@@ -1006,6 +1047,11 @@ const isDescriptiveQuestion = computed(() => {
|
|||||||
return ans === '주관식' || ans.length > 8 || ans.includes(' ') || ans.includes('및') || ans.includes('와')
|
return ans === '주관식' || ans.length > 8 || ans.includes(' ') || ans.includes('및') || ans.includes('와')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const hasStoredCorrectAnswer = computed(() => {
|
||||||
|
const ans = currentQuestion.value?.correctAnswerStr?.trim()
|
||||||
|
return !!ans && ans !== '주관식'
|
||||||
|
})
|
||||||
|
|
||||||
const isPdf = computed(() => {
|
const isPdf = computed(() => {
|
||||||
const url = currentQuestion.value.imageUrl
|
const url = currentQuestion.value.imageUrl
|
||||||
if (!url) return false
|
if (!url) return false
|
||||||
@@ -1403,6 +1449,7 @@ interface QuestionState {
|
|||||||
isCorrect: boolean
|
isCorrect: boolean
|
||||||
userDescriptiveAnswer: string
|
userDescriptiveAnswer: string
|
||||||
descriptiveGradingResult: DescriptiveGradingRecord | null
|
descriptiveGradingResult: DescriptiveGradingRecord | null
|
||||||
|
usedDescriptiveNormalGrading: boolean
|
||||||
}
|
}
|
||||||
const questionStates = ref<Record<number, QuestionState>>({})
|
const questionStates = ref<Record<number, QuestionState>>({})
|
||||||
|
|
||||||
@@ -1414,7 +1461,8 @@ function saveCurrentState() {
|
|||||||
showFeedback: showFeedback.value,
|
showFeedback: showFeedback.value,
|
||||||
isCorrect: isCorrect.value,
|
isCorrect: isCorrect.value,
|
||||||
userDescriptiveAnswer: userDescriptiveAnswer.value,
|
userDescriptiveAnswer: userDescriptiveAnswer.value,
|
||||||
descriptiveGradingResult: descriptiveGradingResult.value
|
descriptiveGradingResult: descriptiveGradingResult.value,
|
||||||
|
usedDescriptiveNormalGrading: usedDescriptiveNormalGrading.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1430,6 +1478,7 @@ function loadState(index: number) {
|
|||||||
isCorrect.value = state.isCorrect
|
isCorrect.value = state.isCorrect
|
||||||
userDescriptiveAnswer.value = state.userDescriptiveAnswer || ''
|
userDescriptiveAnswer.value = state.userDescriptiveAnswer || ''
|
||||||
descriptiveGradingResult.value = state.descriptiveGradingResult || null
|
descriptiveGradingResult.value = state.descriptiveGradingResult || null
|
||||||
|
usedDescriptiveNormalGrading.value = state.usedDescriptiveNormalGrading || false
|
||||||
} else {
|
} else {
|
||||||
selectedChoiceIndex.value = -1
|
selectedChoiceIndex.value = -1
|
||||||
userTextAnswer.value = ''
|
userTextAnswer.value = ''
|
||||||
@@ -1440,6 +1489,7 @@ function loadState(index: number) {
|
|||||||
descriptiveGradingResult.value = null
|
descriptiveGradingResult.value = null
|
||||||
uploadedOcrImageBase64.value = ''
|
uploadedOcrImageBase64.value = ''
|
||||||
ocrResultText.value = null
|
ocrResultText.value = null
|
||||||
|
usedDescriptiveNormalGrading.value = false
|
||||||
}
|
}
|
||||||
loadGradingHistory()
|
loadGradingHistory()
|
||||||
}
|
}
|
||||||
@@ -1477,6 +1527,7 @@ function resetQuiz() {
|
|||||||
userTextAnswer.value = ''
|
userTextAnswer.value = ''
|
||||||
userOXAnswer.value = ''
|
userOXAnswer.value = ''
|
||||||
questionStates.value = {}
|
questionStates.value = {}
|
||||||
|
scoredQuestions.value = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
const togglingBookmark = ref(false)
|
const togglingBookmark = ref(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user