refactor: 减分从满分开始
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
9941db1bac
commit
235e71fba3
|
|
@ -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
|
||||
}
|
||||
|
||||
// 问题卷对话框引用
|
||||
|
|
|
|||
Loading…
Reference in New Issue