refactor: 减分从满分开始
continuous-integration/drone/push Build is passing Details

This commit is contained in:
AfyerCu 2025-10-18 12:33:34 +08:00
parent 9941db1bac
commit 235e71fba3
1 changed files with 19 additions and 1 deletions

View File

@ -145,10 +145,28 @@ function undo() {
*/
function handleQuickScore(value: number) {
if (currentMarkingData.value) {
const currentScore = currentMarkingData.value.score === -1 ? 0 : currentMarkingData.value.score
// -1
const currentScore =
currentMarkingData.value.score === -1
? markingSettings.value.scoreMode === 'subtract'
? props.question.fullScore
: 0
: currentMarkingData.value.score
//
if (value > 0 && currentScore >= props.question.fullScore) {
return false
}
if (value < 0 && currentScore <= 0) {
return false
}
const newScore = Math.max(0, Math.min(props.question.fullScore, currentScore + value))
currentMarkingData.value.score = newScore
return true
}
return false
}
//