feat: show spent time in participant list, fix timer sounds
This commit is contained in:
@@ -33,6 +33,7 @@ type SpeakerInfo struct {
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
TimeLimit int `json:"timeLimit"`
|
||||
TimeSpent int `json:"timeSpent"`
|
||||
Order int `json:"order"`
|
||||
Status SpeakerStatus `json:"status"`
|
||||
}
|
||||
|
||||
@@ -118,12 +118,14 @@ func (t *Timer) startNextSpeaker(now time.Time) {
|
||||
return
|
||||
}
|
||||
|
||||
// Mark previous speaker as done (only if they were speaking, not skipped)
|
||||
// Mark previous speaker as done and save their time spent
|
||||
if t.currentSpeakerID != 0 {
|
||||
timeSpent := int(now.Sub(t.speakerStartTime).Seconds())
|
||||
for i := range t.allSpeakers {
|
||||
if t.allSpeakers[i].ID == t.currentSpeakerID {
|
||||
if t.allSpeakers[i].Status == models.SpeakerStatusSpeaking {
|
||||
t.allSpeakers[i].Status = models.SpeakerStatusDone
|
||||
t.allSpeakers[i].TimeSpent = timeSpent
|
||||
}
|
||||
break
|
||||
}
|
||||
@@ -299,9 +301,17 @@ func (t *Timer) Stop() {
|
||||
t.mu.Unlock()
|
||||
return
|
||||
}
|
||||
// Mark current speaker as done before stopping
|
||||
// Mark current speaker as done and save their time spent
|
||||
if t.currentSpeakerID != 0 {
|
||||
t.updateSpeakerStatus(t.currentSpeakerID, models.SpeakerStatusDone)
|
||||
now := time.Now()
|
||||
timeSpent := int(now.Sub(t.speakerStartTime).Seconds())
|
||||
for i := range t.allSpeakers {
|
||||
if t.allSpeakers[i].ID == t.currentSpeakerID {
|
||||
t.allSpeakers[i].Status = models.SpeakerStatusDone
|
||||
t.allSpeakers[i].TimeSpent = timeSpent
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
t.running = false
|
||||
t.paused = false
|
||||
|
||||
Reference in New Issue
Block a user