增加无正确答案的体型, 修改计分方式
This commit is contained in:
parent
e4625becf7
commit
c65a9a500b
@ -106,25 +106,30 @@ class ExamController extends BaseController {
|
||||
if (type == 1) { // type = 1 为客户端上报的超时消息, 直接判负
|
||||
result = -1
|
||||
overtime = 1
|
||||
} else if (time < 0){
|
||||
} else if (time < 0 && record.type !== 3){
|
||||
result = -1
|
||||
overtime = 1
|
||||
}
|
||||
statMap.timeLast = Date.now()
|
||||
statMap.answer.set(id, result)
|
||||
statMap.total ++
|
||||
if (result == 0) {
|
||||
statMap.rightCount++
|
||||
statMap.comboCount++
|
||||
statMap.maxCombo = Math.max(statMap.maxCombo, statMap.comboCount)
|
||||
} else {
|
||||
statMap.errorCount++
|
||||
statMap.comboCount = 0
|
||||
if (record.type !== 3) {
|
||||
if (result == 0) {
|
||||
statMap.rightCount++
|
||||
statMap.comboCount++
|
||||
statMap.maxCombo = Math.max(statMap.maxCombo, statMap.comboCount)
|
||||
} else {
|
||||
statMap.errorCount++
|
||||
statMap.comboCount = 0
|
||||
}
|
||||
}
|
||||
statMap.timeLeft = (statMap.timeLast - history.createdAt.getTime()) / 1000
|
||||
history.status = 1
|
||||
|
||||
let score = result ? calcExamScore(time, statMap.comboCount) : 0
|
||||
let score = result === 0 ? calcExamScore(time, statMap.comboCount) : 0
|
||||
if(record.type === 3) {
|
||||
score = 0
|
||||
}
|
||||
statMap.score += score
|
||||
history.markModified('members')
|
||||
await history.save()
|
||||
|
@ -117,13 +117,15 @@ class PuzzleController extends BaseController {
|
||||
statMap.timeLast = Date.now()
|
||||
statMap.answer.set(id, result)
|
||||
statMap.total ++
|
||||
if (result == 0) {
|
||||
statMap.rightCount++
|
||||
statMap.comboCount++
|
||||
statMap.maxCombo = Math.max(statMap.maxCombo, statMap.comboCount)
|
||||
} else {
|
||||
statMap.errorCount++
|
||||
statMap.comboCount = 0
|
||||
if (record.type !== 1) {
|
||||
if (result == 0) {
|
||||
statMap.rightCount++
|
||||
statMap.comboCount++
|
||||
statMap.maxCombo = Math.max(statMap.maxCombo, statMap.comboCount)
|
||||
} else {
|
||||
statMap.errorCount++
|
||||
statMap.comboCount = 0
|
||||
}
|
||||
}
|
||||
history.status = 1
|
||||
history.markModified('members')
|
||||
@ -131,7 +133,10 @@ class PuzzleController extends BaseController {
|
||||
await history.save()
|
||||
let rspData: any = { result: result === 0, answer: record.answers[0], stats: history.members }
|
||||
if (mode == 1) {
|
||||
let score = result ? calcPvpScore(history.scheduleKey, statMap.comboCount) : 0
|
||||
let score = result === 0 ? calcPvpScore(history.scheduleKey, statMap.comboCount) : 0
|
||||
if (record.type === 3) {
|
||||
score = 0
|
||||
}
|
||||
await broadcast(history.room, 'answer', {accountid, result, score})
|
||||
await updateScore(history.room, [{accountid, score }])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user