add todo.triggered to indicate should be set to todo
This commit is contained in:
@@ -1,8 +1,16 @@
|
|||||||
package pttodo
|
package pttodo
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
type Todo struct {
|
type Todo struct {
|
||||||
Todo string
|
Todo string
|
||||||
Detail string `yaml:",omitempty"`
|
Detail string `yaml:",omitempty"`
|
||||||
TS TS `yaml:",omitempty"`
|
TS TS `yaml:",omitempty"`
|
||||||
Schedule Schedule `yaml:",omitempty"`
|
Schedule Schedule `yaml:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (todo Todo) Triggered() bool {
|
||||||
|
last := todo.TS
|
||||||
|
next, err := todo.Schedule.Next(last.time())
|
||||||
|
return err == nil && time.Now().After(next)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user