~ewintr/gte

5147625901e9a0f5771a59cf281c598233a05195 — Erik Winter 3 months ago 3d1f536
apply updates in commands and done test
M cmd/cli/command/folder.go => cmd/cli/command/folder.go +2 -1
@@ 35,7 35,8 @@ func NewFolder(conf *configuration.Configuration, cmdArgs []string) (*Folder, er
	}

	reqs := process.ListReqs{
		Folder: folder,
		Folder:       folder,
		ApplyUpdates: true,
	}
	lister := process.NewList(local, reqs)


M cmd/cli/command/project.go => cmd/cli/command/project.go +2 -1
@@ 22,7 22,8 @@ func NewProject(conf *configuration.Configuration, cmdArgs []string) (*Project, 
		return &Project{}, ErrInvalidAmountOfArgs
	}
	reqs := process.ListReqs{
		Project: strings.ToLower(cmdArgs[0]),
		Project:      strings.ToLower(cmdArgs[0]),
		ApplyUpdates: true,
	}
	lister := process.NewList(local, reqs)


M cmd/cli/command/today.go => cmd/cli/command/today.go +1 -0
@@ 21,6 21,7 @@ func NewToday(conf *configuration.Configuration) (*Today, error) {
	reqs := process.ListReqs{
		Due:           task.Today,
		IncludeBefore: true,
		ApplyUpdates:  true,
	}
	lister := process.NewList(local, reqs)


M cmd/cli/command/tomorrow.go => cmd/cli/command/tomorrow.go +2 -1
@@ 20,7 20,8 @@ func NewTomorrow(conf *configuration.Configuration) (*Tomorrow, error) {
	}

	reqs := process.ListReqs{
		Due: task.Today.Add(1),
		Due:          task.Today.Add(1),
		ApplyUpdates: true,
	}
	lister := process.NewList(local, reqs)


M cmd/cli/command/week.go => cmd/cli/command/week.go +1 -0
@@ 21,6 21,7 @@ func NewWeek(conf *configuration.Configuration) (*Week, error) {
	reqs := process.ListReqs{
		Due:           task.Today.Add(7),
		IncludeBefore: true,
		ApplyUpdates:  true,
	}
	return &Week{
		lister: process.NewList(local, reqs),

M internal/process/list.go => internal/process/list.go +7 -0
@@ 67,6 67,13 @@ func (l *List) Process() (*ListResult, error) {
		for i := range potentialTasks {
			potentialTasks[i].ApplyUpdate()
		}
		var undoneTasks []*task.LocalTask
		for _, pt := range potentialTasks {
			if !pt.Done {
				undoneTasks = append(undoneTasks, pt)
			}
		}
		potentialTasks = undoneTasks
	}

	// folder

M internal/process/list_test.go => internal/process/list_test.go +10 -3
@@ 114,13 114,20 @@ func TestListProcess(t *testing.T) {

	t.Run("applyupdates", func(t *testing.T) {
		mem := storage.NewMemory()
		test.OK(t, mem.SetTasks([]*task.Task{task2, task4}))
		lu := &task.LocalUpdate{
		test.OK(t, mem.SetTasks([]*task.Task{task2, task3, task4}))
		lu3 := &task.LocalUpdate{
			ForVersion: task3.Version,
			Fields:     []string{task.FIELD_PROJECT, task.FIELD_DONE},
			Project:    "project4",
			Done:       true,
		}
		test.OK(t, mem.SetLocalUpdate(task3.Id, lu3))
		lu4 := &task.LocalUpdate{
			ForVersion: task4.Version,
			Fields:     []string{task.FIELD_PROJECT},
			Project:    "project4",
		}
		test.OK(t, mem.SetLocalUpdate(task4.Id, lu))
		test.OK(t, mem.SetLocalUpdate(task4.Id, lu4))

		lr := process.ListReqs{
			Project:      "project4",