feat: display room with current person in bottom
This commit is contained in:
parent
e4c56506be
commit
af53bda10e
|
@ -40,10 +40,13 @@ type roomTableData struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (room *roomTableData)Persons() []personData {
|
func (room *roomTableData)Persons() []personData {
|
||||||
persons := make([]personData, 0, room.Total())
|
total := room.Total()
|
||||||
|
persons := make([]personData, 0, total)
|
||||||
|
currentPersonIndex := slices.Index(room.Paricipants, room.currentPerson)
|
||||||
for i, pId := range room.Paricipants {
|
for i, pId := range room.Paricipants {
|
||||||
personData := personDataFromRoom(room, pId)
|
personData := personDataFromRoom(room, pId)
|
||||||
personData.Index = i
|
// to have index 0 for 'current person'
|
||||||
|
personData.Index = (i - currentPersonIndex + total) % total
|
||||||
persons = append(persons, personData)
|
persons = append(persons, personData)
|
||||||
}
|
}
|
||||||
return persons
|
return persons
|
||||||
|
|
Loading…
Reference in New Issue