From 054efd14edf9c94e3d1753b47343aa1e0518f18c Mon Sep 17 00:00:00 2001 From: le king fu Date: Sat, 7 Mar 2026 17:52:47 -0500 Subject: [PATCH] Sort completed subtasks to bottom of list Fixes #12: completed subtasks now sort after uncompleted ones, keeping actionable items at the top. Applied to both task detail view and home screen widget. Co-Authored-By: Claude Opus 4.6 --- src/db/repository/tasks.ts | 2 +- src/services/widgetSync.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/db/repository/tasks.ts b/src/db/repository/tasks.ts index 0d5d376..a05382b 100644 --- a/src/db/repository/tasks.ts +++ b/src/db/repository/tasks.ts @@ -105,7 +105,7 @@ export async function getSubtasks(parentId: string) { .select() .from(tasks) .where(eq(tasks.parentId, parentId)) - .orderBy(asc(tasks.position)); + .orderBy(asc(tasks.completed), asc(tasks.position)); } export async function getTaskById(id: string) { diff --git a/src/services/widgetSync.ts b/src/services/widgetSync.ts index c78805a..0ca2e01 100644 --- a/src/services/widgetSync.ts +++ b/src/services/widgetSync.ts @@ -117,7 +117,7 @@ export async function syncWidgetData(): Promise { .select({ id: tasks.id, title: tasks.title, completed: tasks.completed }) .from(tasks) .where(eq(tasks.parentId, task.id)) - .orderBy(asc(tasks.position)); + .orderBy(asc(tasks.completed), asc(tasks.position)); task.subtasks = subs; } }