Skip to content

Commit e7dd7fc

Browse files
committed
[bugfix] Count time during breaks
1 parent 49eafe3 commit e7dd7fc

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

internal/app/controller/engine.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,12 @@ func (e *Engine) loadStages() {
170170
e.StageTimes[StageShootoutBreak] = e.config.Overtime.BreakAfter
171171
}
172172

173+
func (e *Engine) countStageTime() bool {
174+
return e.State.Stage.IsPausedStage() || e.State.GameState() == GameStateRunning
175+
}
176+
173177
func (e *Engine) updateTimes(delta time.Duration) {
174-
if e.State.GameState() == GameStateRunning {
178+
if e.countStageTime() {
175179
e.State.StageTimeElapsed += delta
176180
e.State.StageTimeLeft -= delta
177181

internal/app/controller/state.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ func (s Stage) IsPreStage() bool {
130130
return false
131131
}
132132

133+
func (s Stage) IsPausedStage() bool {
134+
switch s {
135+
case StageHalfTime, StageOvertimeBreak, StageOvertimeHalfTime, StageShootoutBreak:
136+
return true
137+
}
138+
return false
139+
}
140+
133141
// RefCommand is a command to be send to the teams
134142
type RefCommand string
135143

0 commit comments

Comments
 (0)