修正检查所有人是否都已经答了当前题的bug

This commit is contained in:
zhl 2021-05-06 11:27:39 +08:00
parent 81ee1f0316
commit e480435aa4

View File

@ -1,5 +1,6 @@
import { import {
beginGame, closeRoom, beginGame,
closeRoom,
endGame, endGame,
sendQuestion, sendQuestion,
updateRound, updateRound,
@ -34,15 +35,22 @@ export function transformRecord(records: any[]) {
}) })
} }
/**
*
*
* @param history
* @param {string} qid
* @return {boolean}
*/
export function checkSubFinish(history: any, qid: string) { export function checkSubFinish(history: any, qid: string) {
let count = 0
for (let [key, val] of history.members) { for (let [key, val] of history.members) {
if (val.answer?.has(qid)) { if (!val.answer?.has(qid)) {
count ++ return false
} }
} }
return count >= history.questions.length; return true
} }
/** /**
* *
* @param {string} roomId * @param {string} roomId