fix: remove all marks when noone speaks next

if room comes to a state where last person stopped speaking,
then setting room to clean state is logical,
next person to start speaking is the only reference point
This commit is contained in:
efim
2023-12-03 14:39:40 +00:00
parent acd9f4fc62
commit ea85460c0a
2 changed files with 40 additions and 0 deletions

View File

@@ -53,6 +53,7 @@ func (r *Room) RaiseHand(p PersonId, gesture HandGesture) Room {
// - we should find next speaker
// - assign room.CurrentSpeaker to next speaker or to PersonId(0) to indicate that noone is speaking
// - if next speaker has gesture of higher priority - set Mark to current speaker for their gesture level
// when there is not next speaker, remove all marks
func (r *Room) ReleaseHand(p PersonId) {
// releasing a hand of a current speaker should result in selection of a new speaker
log.Printf("about to release hand of %d in %+v", p, r)
@@ -76,6 +77,7 @@ func (r *Room) ReleaseHand(p PersonId) {
if !nextSpeakerFound {
log.Printf("there is not next speaker, that's ok")
r.CurrentSpeaker = PersonId(0)
r.Marks = make(map[HandGesture]PersonId)
} else {
// searching for the next speaker
currentSpeakerGesture := handReleaseGesture