Fix interval end event trigger
This commit is contained in:
parent
64ea47f42b
commit
fefe9bb6aa
3
main.go
3
main.go
@ -147,8 +147,6 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
// Handle timer update for each second
|
||||
m.remaining -= time.Second
|
||||
if m.remaining < 0 {
|
||||
m.runCommands(m.onIntervalEnd)
|
||||
|
||||
if m.isFocus {
|
||||
// Focus period ends, switch to break
|
||||
m.isFocus = false
|
||||
@ -162,6 +160,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
// Break ends, switch back to focus or next interval
|
||||
m.isFocus = true
|
||||
m.intervalNum++
|
||||
m.runCommands(m.onIntervalEnd)
|
||||
if m.intervalNum > m.intervals {
|
||||
// All intervals completed
|
||||
return m, tea.Quit
|
||||
|
Loading…
Reference in New Issue
Block a user