Implemented awarding multiple players for non-buzzer questions

This commit is contained in:
EisiBaer committed 2023-07-14 18:07:20 +02:00
1 parent 5ef8ea86bb
commit 58f8fedaec
5 files changed
+20 -38

No files matched your search

@@ -86,29 +86,6 @@ exports.checkPlayerAcceptAnswers = ( playerId ) => {
});
}
/**
* Checks if a player is allowed to choose a BoardEntry
* @param {String} playerId
* @returns A promise which resolves with wheter the player is allowed to choose a BoardEntry or not. Rejects if an error occurs.
*/
exports.checkPlayerCanChoose = ( playerId ) => {
return new Promise((resolve, reject) => {
PlayerModel.findById( playerId )
.then( ( player ) => {
if( player ){
resolve( player.isChoosing );
} else {
let playerNotFoundError = new Error(`No player found with id "${playerId}"`);
playerNotFoundError.name = "NotFoundError";
reject(playerNotFoundError);
}
})
.catch( ( err ) => {
reject( err );
})
});
}
/**
* Checks if a player is allowed to currently answer a question and sets it to the specified value
* @param {String} playerId