Commit
+8 -5 +/-3 browse
1 | diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go |
2 | index 6256d79..9aaa5ae 100644 |
3 | --- a/pkg/cmd/cmd.go |
4 | +++ b/pkg/cmd/cmd.go |
5 | @@ -142,11 +142,6 @@ func begin(config *pomo.Config) func(*cli.Cmd) { |
6 | return err |
7 | } |
8 | task = read |
9 | - err = db.DeletePomodoros(tx, *taskId) |
10 | - if err != nil { |
11 | - return err |
12 | - } |
13 | - task.Pomodoros = []*pomo.Pomodoro{} |
14 | return nil |
15 | })) |
16 | runner, err := pomo.NewTaskRunner(task, config) |
17 | diff --git a/pkg/internal/runner.go b/pkg/internal/runner.go |
18 | index 3ce1276..af12800 100644 |
19 | --- a/pkg/internal/runner.go |
20 | +++ b/pkg/internal/runner.go |
21 | @@ -42,6 +42,7 @@ func NewTaskRunner(task *Task, config *Config) (*TaskRunner, error) { |
22 | return nil, err |
23 | } |
24 | tr := &TaskRunner{ |
25 | + count: len(task.Pomodoros), |
26 | taskID: task.ID, |
27 | taskMessage: task.Message, |
28 | nPomodoros: task.NPomodoros, |
29 | diff --git a/pkg/internal/store.go b/pkg/internal/store.go |
30 | index 76a0906..28d3993 100644 |
31 | --- a/pkg/internal/store.go |
32 | +++ b/pkg/internal/store.go |
33 | @@ -123,6 +123,13 @@ func (s Store) ReadTask(tx *sql.Tx, taskID int) (*Task, error) { |
34 | if tags != "" { |
35 | task.Tags = strings.Split(tags, ",") |
36 | } |
37 | + pomodoros, err := s.ReadPomodoros(tx, task.ID) |
38 | + if err != nil { |
39 | + return nil, err |
40 | + } |
41 | + for _, pomodoro := range pomodoros { |
42 | + task.Pomodoros = append(task.Pomodoros, pomodoro) |
43 | + } |
44 | return task, nil |
45 | } |
46 |