apply updates in commands and done test
This commit is contained in:
parent
3d1f5361c8
commit
5147625901
|
@ -35,7 +35,8 @@ func NewFolder(conf *configuration.Configuration, cmdArgs []string) (*Folder, er
|
||||||
}
|
}
|
||||||
|
|
||||||
reqs := process.ListReqs{
|
reqs := process.ListReqs{
|
||||||
Folder: folder,
|
Folder: folder,
|
||||||
|
ApplyUpdates: true,
|
||||||
}
|
}
|
||||||
lister := process.NewList(local, reqs)
|
lister := process.NewList(local, reqs)
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@ func NewProject(conf *configuration.Configuration, cmdArgs []string) (*Project,
|
||||||
return &Project{}, ErrInvalidAmountOfArgs
|
return &Project{}, ErrInvalidAmountOfArgs
|
||||||
}
|
}
|
||||||
reqs := process.ListReqs{
|
reqs := process.ListReqs{
|
||||||
Project: strings.ToLower(cmdArgs[0]),
|
Project: strings.ToLower(cmdArgs[0]),
|
||||||
|
ApplyUpdates: true,
|
||||||
}
|
}
|
||||||
lister := process.NewList(local, reqs)
|
lister := process.NewList(local, reqs)
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ func NewToday(conf *configuration.Configuration) (*Today, error) {
|
||||||
reqs := process.ListReqs{
|
reqs := process.ListReqs{
|
||||||
Due: task.Today,
|
Due: task.Today,
|
||||||
IncludeBefore: true,
|
IncludeBefore: true,
|
||||||
|
ApplyUpdates: true,
|
||||||
}
|
}
|
||||||
lister := process.NewList(local, reqs)
|
lister := process.NewList(local, reqs)
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,8 @@ func NewTomorrow(conf *configuration.Configuration) (*Tomorrow, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
reqs := process.ListReqs{
|
reqs := process.ListReqs{
|
||||||
Due: task.Today.Add(1),
|
Due: task.Today.Add(1),
|
||||||
|
ApplyUpdates: true,
|
||||||
}
|
}
|
||||||
lister := process.NewList(local, reqs)
|
lister := process.NewList(local, reqs)
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ func NewWeek(conf *configuration.Configuration) (*Week, error) {
|
||||||
reqs := process.ListReqs{
|
reqs := process.ListReqs{
|
||||||
Due: task.Today.Add(7),
|
Due: task.Today.Add(7),
|
||||||
IncludeBefore: true,
|
IncludeBefore: true,
|
||||||
|
ApplyUpdates: true,
|
||||||
}
|
}
|
||||||
return &Week{
|
return &Week{
|
||||||
lister: process.NewList(local, reqs),
|
lister: process.NewList(local, reqs),
|
||||||
|
|
|
@ -67,6 +67,13 @@ func (l *List) Process() (*ListResult, error) {
|
||||||
for i := range potentialTasks {
|
for i := range potentialTasks {
|
||||||
potentialTasks[i].ApplyUpdate()
|
potentialTasks[i].ApplyUpdate()
|
||||||
}
|
}
|
||||||
|
var undoneTasks []*task.LocalTask
|
||||||
|
for _, pt := range potentialTasks {
|
||||||
|
if !pt.Done {
|
||||||
|
undoneTasks = append(undoneTasks, pt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
potentialTasks = undoneTasks
|
||||||
}
|
}
|
||||||
|
|
||||||
// folder
|
// folder
|
||||||
|
|
|
@ -114,13 +114,20 @@ func TestListProcess(t *testing.T) {
|
||||||
|
|
||||||
t.Run("applyupdates", func(t *testing.T) {
|
t.Run("applyupdates", func(t *testing.T) {
|
||||||
mem := storage.NewMemory()
|
mem := storage.NewMemory()
|
||||||
test.OK(t, mem.SetTasks([]*task.Task{task2, task4}))
|
test.OK(t, mem.SetTasks([]*task.Task{task2, task3, task4}))
|
||||||
lu := &task.LocalUpdate{
|
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,
|
ForVersion: task4.Version,
|
||||||
Fields: []string{task.FIELD_PROJECT},
|
Fields: []string{task.FIELD_PROJECT},
|
||||||
Project: "project4",
|
Project: "project4",
|
||||||
}
|
}
|
||||||
test.OK(t, mem.SetLocalUpdate(task4.Id, lu))
|
test.OK(t, mem.SetLocalUpdate(task4.Id, lu4))
|
||||||
|
|
||||||
lr := process.ListReqs{
|
lr := process.ListReqs{
|
||||||
Project: "project4",
|
Project: "project4",
|
||||||
|
|
Loading…
Reference in New Issue