Merge pull request #57 from labno/master
Fix for issue 44, runs always starting at 0 pomodoros
This commit is contained in:
commit
e603f282cc
|
@ -142,11 +142,6 @@ func begin(config *pomo.Config) func(*cli.Cmd) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
task = read
|
task = read
|
||||||
err = db.DeletePomodoros(tx, *taskId)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
task.Pomodoros = []*pomo.Pomodoro{}
|
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
runner, err := pomo.NewTaskRunner(task, config)
|
runner, err := pomo.NewTaskRunner(task, config)
|
||||||
|
|
|
@ -42,6 +42,7 @@ func NewTaskRunner(task *Task, config *Config) (*TaskRunner, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
tr := &TaskRunner{
|
tr := &TaskRunner{
|
||||||
|
count: len(task.Pomodoros),
|
||||||
taskID: task.ID,
|
taskID: task.ID,
|
||||||
taskMessage: task.Message,
|
taskMessage: task.Message,
|
||||||
nPomodoros: task.NPomodoros,
|
nPomodoros: task.NPomodoros,
|
||||||
|
|
|
@ -123,6 +123,13 @@ func (s Store) ReadTask(tx *sql.Tx, taskID int) (*Task, error) {
|
||||||
if tags != "" {
|
if tags != "" {
|
||||||
task.Tags = strings.Split(tags, ",")
|
task.Tags = strings.Split(tags, ",")
|
||||||
}
|
}
|
||||||
|
pomodoros, err := s.ReadPomodoros(tx, task.ID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for _, pomodoro := range pomodoros {
|
||||||
|
task.Pomodoros = append(task.Pomodoros, pomodoro)
|
||||||
|
}
|
||||||
return task, nil
|
return task, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue