fix: Implement TaskListParams filtering in SQLite FindMany method

This commit is contained in:
Erik Winter (aider) 2024-12-29 12:03:01 +01:00
parent e49562b7f6
commit 6664b24a23
1 changed files with 5 additions and 3 deletions

View File

@ -70,7 +70,7 @@ FROM tasks`)
if err != nil { if err != nil {
return nil, fmt.Errorf("%w: %v", ErrSqliteFailure, err) return nil, fmt.Errorf("%w: %v", ErrSqliteFailure, err)
} }
result := make([]item.Task, 0) tasks := make([]item.Task, 0)
defer rows.Close() defer rows.Close()
for rows.Next() { for rows.Next() {
var tsk item.Task var tsk item.Task
@ -87,10 +87,12 @@ FROM tasks`)
tsk.Duration = dur tsk.Duration = dur
tsk.Recurrer = item.NewRecurrer(recurStr) tsk.Recurrer = item.NewRecurrer(recurStr)
result = append(result, tsk) if storage.Match(tsk, params) {
tasks = append(tasks, tsk)
}
} }
return result, nil return tasks, nil
} }
func (s *SqliteTask) Delete(id string) error { func (s *SqliteTask) Delete(id string) error {