diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index 6256d79..9aaa5ae 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -142,11 +142,6 @@ func begin(config *pomo.Config) func(*cli.Cmd) { return err } task = read - err = db.DeletePomodoros(tx, *taskId) - if err != nil { - return err - } - task.Pomodoros = []*pomo.Pomodoro{} return nil })) runner, err := pomo.NewTaskRunner(task, config) diff --git a/pkg/internal/runner.go b/pkg/internal/runner.go index 3ce1276..af12800 100644 --- a/pkg/internal/runner.go +++ b/pkg/internal/runner.go @@ -42,6 +42,7 @@ func NewTaskRunner(task *Task, config *Config) (*TaskRunner, error) { return nil, err } tr := &TaskRunner{ + count: len(task.Pomodoros), taskID: task.ID, taskMessage: task.Message, nPomodoros: task.NPomodoros, diff --git a/pkg/internal/store.go b/pkg/internal/store.go index 76a0906..28d3993 100644 --- a/pkg/internal/store.go +++ b/pkg/internal/store.go @@ -123,6 +123,13 @@ func (s Store) ReadTask(tx *sql.Tx, taskID int) (*Task, error) { if 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 }