exclude empty dates in date list
This commit is contained in:
parent
a9d5da283d
commit
05ad2aa0f0
|
@ -69,21 +69,27 @@ func (t *SqliteTask) FindMany(params storage.TaskListParams) ([]item.Task, error
|
||||||
args := []interface{}{}
|
args := []interface{}{}
|
||||||
|
|
||||||
where := make([]string, 0)
|
where := make([]string, 0)
|
||||||
|
var dateNonEmpty bool
|
||||||
if params.HasRecurrer {
|
if params.HasRecurrer {
|
||||||
where[0] = `recurrer != ''`
|
where[0] = `recurrer != ''`
|
||||||
}
|
}
|
||||||
if !params.From.IsZero() {
|
if !params.From.IsZero() {
|
||||||
where = append(where, `date >= ?`)
|
where = append(where, `date >= ?`)
|
||||||
args = append(args, params.From.String())
|
args = append(args, params.From.String())
|
||||||
|
dateNonEmpty = true
|
||||||
}
|
}
|
||||||
if !params.To.IsZero() {
|
if !params.To.IsZero() {
|
||||||
where = append(where, `date <= ?`)
|
where = append(where, `date <= ?`)
|
||||||
args = append(args, params.To.String())
|
args = append(args, params.To.String())
|
||||||
|
dateNonEmpty = true
|
||||||
}
|
}
|
||||||
if params.Project != "" {
|
if params.Project != "" {
|
||||||
where = append(where, `project = ?`)
|
where = append(where, `project = ?`)
|
||||||
args = append(args, params.Project)
|
args = append(args, params.Project)
|
||||||
}
|
}
|
||||||
|
if dateNonEmpty {
|
||||||
|
where = append(where, `date != ""`)
|
||||||
|
}
|
||||||
|
|
||||||
if len(where) > 0 {
|
if len(where) > 0 {
|
||||||
query += ` WHERE ` + where[0]
|
query += ` WHERE ` + where[0]
|
||||||
|
|
Loading…
Reference in New Issue