Merge pull request #18284 from hiroshisuga/patch-5
[fix] Cannot pick an escaping student who knows he will be picked next
This commit is contained in:
commit
300ffee642
@ -37,15 +37,21 @@ trait SelectRandomViewerReqMsgHdlr extends RightsManagementTrait {
|
|||||||
val usersPicked = Users2x.getRandomlyPickableUsers(liveMeeting.users2x, reduceDuplicatedPick)
|
val usersPicked = Users2x.getRandomlyPickableUsers(liveMeeting.users2x, reduceDuplicatedPick)
|
||||||
|
|
||||||
val randNum = new scala.util.Random
|
val randNum = new scala.util.Random
|
||||||
val pickedUser = if (usersPicked.size == 0) "" else usersPicked(randNum.nextInt(usersPicked.size)).intId
|
var pickedUser = if (usersPicked.size == 0) "" else usersPicked(randNum.nextInt(usersPicked.size)).intId
|
||||||
|
|
||||||
if (reduceDuplicatedPick) {
|
if (reduceDuplicatedPick) {
|
||||||
if (usersPicked.size == 1) {
|
if (usersPicked.size <= 1) {
|
||||||
// Initialise the exemption
|
// Initialise the exemption
|
||||||
val usersToUnexempt = Users2x.findAll(liveMeeting.users2x)
|
val usersToUnexempt = Users2x.findAll(liveMeeting.users2x)
|
||||||
usersToUnexempt foreach { u =>
|
usersToUnexempt foreach { u =>
|
||||||
Users2x.setUserExempted(liveMeeting.users2x, u.intId, false)
|
Users2x.setUserExempted(liveMeeting.users2x, u.intId, false)
|
||||||
}
|
}
|
||||||
|
if (usersPicked.size == 0) {
|
||||||
|
// Pick again
|
||||||
|
val usersRepicked = Users2x.getRandomlyPickableUsers(liveMeeting.users2x, reduceDuplicatedPick)
|
||||||
|
pickedUser = if (usersRepicked.size == 0) "" else usersRepicked(randNum.nextInt(usersRepicked.size)).intId
|
||||||
|
Users2x.setUserExempted(liveMeeting.users2x, pickedUser, true)
|
||||||
|
}
|
||||||
} else if (usersPicked.size > 1) {
|
} else if (usersPicked.size > 1) {
|
||||||
Users2x.setUserExempted(liveMeeting.users2x, pickedUser, true)
|
Users2x.setUserExempted(liveMeeting.users2x, pickedUser, true)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user