summaryrefslogtreecommitdiff
path: root/internal/store/native_tasks.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/store/native_tasks.go')
-rw-r--r--internal/store/native_tasks.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/internal/store/native_tasks.go b/internal/store/native_tasks.go
index 5758407..218675e 100644
--- a/internal/store/native_tasks.go
+++ b/internal/store/native_tasks.go
@@ -22,14 +22,15 @@ func (s *Store) GetNativeTasks() ([]models.Task, error) {
return scanNativeTasks(rows)
}
-// GetNativeTasksByDateRange returns non-completed native tasks due within the given range.
+// GetNativeTasksByDateRange returns non-completed native tasks due within the given range,
+// including overdue tasks (due before start) so they keep appearing until completed.
func (s *Store) GetNativeTasksByDateRange(start, end time.Time) ([]models.Task, error) {
rows, err := s.db.Query(`
SELECT id, content, description, project_name, due_date, priority, completed, labels, created_at
FROM native_tasks
- WHERE completed = 0 AND due_date IS NOT NULL AND due_date >= ? AND due_date < ?
+ WHERE completed = 0 AND due_date IS NOT NULL AND due_date < ?
ORDER BY due_date ASC, priority DESC
- `, start, end)
+ `, end)
if err != nil {
return nil, err
}
@@ -71,6 +72,15 @@ func (s *Store) UpdateNativeTask(id, content, description string) error {
return err
}
+// UpdateNativeTaskDescription updates only a native task's description, leaving content untouched.
+func (s *Store) UpdateNativeTaskDescription(id, description string) error {
+ _, err := s.db.Exec(`
+ UPDATE native_tasks SET description = ?, updated_at = CURRENT_TIMESTAMP
+ WHERE id = ?
+ `, description, id)
+ return err
+}
+
// CompleteNativeTask marks a task as completed.
func (s *Store) CompleteNativeTask(id string) error {
_, err := s.db.Exec(`