Push WithoutDue() down into the search query

This commit is contained in:
Ian Gulliver
2022-07-22 17:58:20 +00:00
parent fb3011e036
commit 897334e11d

View File

@@ -235,9 +235,15 @@ func (p *periodic) WithUnlinkedURL() *periodic {
} }
func (p *periodic) WithoutDue() *periodic { func (p *periodic) WithoutDue() *periodic {
// We can't mutate the query because due_on=null is buggy in the Asana API p.queryMutators = append(p.queryMutators, func(wc *client.WorkspaceClient, q *client.SearchQuery) error {
p.taskFilters = append(p.taskFilters, func(wc *client.WorkspaceClient, _ *client.SearchQuery, t *client.Task) (bool, error) { if q.Due != nil {
return t.ParsedDueOn == nil, nil return fmt.Errorf("Multiple clauses set Due")
}
d := false
q.Due = &d
return nil
}) })
return p return p