fix: change DOING takeover behavior to PENDING and enforce status sort order
- When setting a new task to DOING, the previous DOING task now switches to PENDING instead of TODO - Task display order now prioritizes by status: DONE < DOING < PENDING < TODO, with order field respected within each status group
This commit is contained in:
parent
427f62acca
commit
0d148b694f
2
app.py
2
app.py
@ -347,7 +347,7 @@ def api_update_task_status(task_id):
|
||||
doing_task = t
|
||||
break
|
||||
if doing_task:
|
||||
database.update_task(doing_task["id"], status="todo")
|
||||
database.update_task(doing_task["id"], status="pending")
|
||||
updates["start_time"] = datetime.now().isoformat()
|
||||
else:
|
||||
updates["start_time"] = None
|
||||
|
||||
@ -209,7 +209,12 @@ def get_tasks_sorted(goal_id):
|
||||
|
||||
cur = conn.execute(
|
||||
"""SELECT * FROM tasks WHERE goal_id = ? AND status != 'done'
|
||||
ORDER BY "order" ASC""",
|
||||
ORDER BY CASE status
|
||||
WHEN 'doing' THEN 1
|
||||
WHEN 'pending' THEN 2
|
||||
WHEN 'todo' THEN 3
|
||||
ELSE 4
|
||||
END, "order" ASC""",
|
||||
(goal_id,)
|
||||
)
|
||||
unfinished = [row_to_dict(r) for r in cur.fetchall()]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user