feat: raising hand endpoint

This commit is contained in:
efim
2023-11-12 08:31:42 +00:00
parent 16df084928
commit 34d610a8c8
5 changed files with 122 additions and 7 deletions

View File

@@ -30,6 +30,22 @@ func (r *Room)InitMaps() {
}
}
// if you have no hand raised - select any hand
// if you are not speaking and have a hand raise - just exchange
// if you are speaking - change nothing
// if nobody is speaking, set this person as a first speaker
func (r *Room) RaiseHand(p PersonId, gesture HandGesture) Room {
if (r.CurrentSpeaker == p) {
// if person already speaking, should first end speaking
return *r
}
r.ParticipantHands[p] = gesture
if r.CurrentSpeaker == PersonId(0) {
r.CurrentSpeaker = p
}
return *r
}
// and how would i organize?
// i should have map[HandGesture]ParticipantId as mark. for 'from where to go clockwise if returning a level lover'
// now i want methods that for some person raise some hand, so i guess it adds what? to map[ParticipantId]HandGesture
@@ -161,6 +177,13 @@ const (
Meta
)
func GestureFromInt(num int) (HandGesture, bool) {
if (num >= int(ChangeTopic) && num <= int(Meta)) {
return HandGesture(num), true
}
return HandGesture(0), false
}
// String() method to print the name of the days
func (g HandGesture) String() string {
return [...]string{"Change Topic", "Probing Quesion", "Expand", "Clarifying Quesion", "Meta"}[g]