only write TS on a todo if writeTS is set
parent
8002b5e75c
commit
fdb24fcc60
|
|
@ -7,11 +7,12 @@ import (
|
||||||
|
|
||||||
type Todo struct {
|
type Todo struct {
|
||||||
Todo string
|
Todo string
|
||||||
TS TS
|
|
||||||
Details string `yaml:",omitempty"`
|
Details string `yaml:",omitempty"`
|
||||||
Schedule Schedule `yaml:",omitempty"`
|
Schedule Schedule `yaml:",omitempty"`
|
||||||
Tags string `yaml:",omitempty"`
|
Tags string `yaml:",omitempty"`
|
||||||
Subtasks []Todo `yaml:",omitempty"`
|
Subtasks []Todo `yaml:",omitempty"`
|
||||||
|
TS TS `yaml:",omitempty"`
|
||||||
|
writeTS bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (todo Todo) Triggered() bool {
|
func (todo Todo) Triggered() bool {
|
||||||
|
|
@ -21,6 +22,11 @@ func (todo Todo) Triggered() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (todo Todo) MarshalYAML() (interface{}, error) {
|
func (todo Todo) MarshalYAML() (interface{}, error) {
|
||||||
|
if !todo.writeTS {
|
||||||
|
todo.TS = 0
|
||||||
|
} else {
|
||||||
|
todo.TS = TS(todo.TS.time().Unix())
|
||||||
|
}
|
||||||
if fmt.Sprint(todo) == fmt.Sprint(Todo{Todo: todo.Todo}) {
|
if fmt.Sprint(todo) == fmt.Sprint(Todo{Todo: todo.Todo}) {
|
||||||
return todo.Todo, nil
|
return todo.Todo, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue