修正检查所有人是否都已经答了当前题的bug
This commit is contained in:
parent
81ee1f0316
commit
e480435aa4
@ -1,5 +1,6 @@
|
||||
import {
|
||||
beginGame, closeRoom,
|
||||
beginGame,
|
||||
closeRoom,
|
||||
endGame,
|
||||
sendQuestion,
|
||||
updateRound,
|
||||
@ -34,15 +35,22 @@ export function transformRecord(records: any[]) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否所有人都已经答了当前题目
|
||||
*
|
||||
* @param history
|
||||
* @param {string} qid
|
||||
* @return {boolean}
|
||||
*/
|
||||
export function checkSubFinish(history: any, qid: string) {
|
||||
let count = 0
|
||||
for (let [key, val] of history.members) {
|
||||
if (val.answer?.has(qid)) {
|
||||
count ++
|
||||
if (!val.answer?.has(qid)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return count >= history.questions.length;
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始游戏
|
||||
* @param {string} roomId
|
||||
|
Loading…
x
Reference in New Issue
Block a user