Fixes autoJoiningToQuizGroup algorithm

parent 280e64cf
......@@ -97,7 +97,7 @@ class MemberDAO extends AbstractDAO<Array<MemberEntity>> {
DbDAO.deleteMany(DbCollection.Members, { currentQuizName: removedQuiz.name });
}
public getMembersByQuizGroup(name: string): object {
public getMemberAmountPerQuizGroup(name: string): object {
const result = {};
this.getMembersOfQuiz(name).forEach(member => {
......
......@@ -699,7 +699,8 @@ export class QuizRouter extends AbstractRouter {
let groupName = 'Default';
if (activeQuiz.sessionConfig.nicks.memberGroups.length > 1) {
groupName = Object.values(MemberDAO.getMembersByQuizGroup(activeQuiz.name)).sort()[0];
const memberGroupLoad = MemberDAO.getMemberAmountPerQuizGroup(activeQuiz.name);
groupName = Object.entries(memberGroupLoad).sort((a, b) => a[1] - b[1])[0][0];
}
return {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment