vibe-kanban icon indicating copy to clipboard operation
vibe-kanban copied to clipboard

feat: Order projects by most recently used (Vibe Kanban)

Open britannio opened this issue 4 months ago • 1 comments

Summary

This PR updates the project listing to order projects from most to least recently used, improving discoverability of active projects.

Changes

  • Modified Project::find_all() in crates/db/src/models/project.rs to order projects by recent task activity
  • Uses a LEFT JOIN with a subquery that finds the maximum task_attempts.updated_at per project
  • Projects with recent task activity appear first
  • Projects without any task activity fall back to ordering by created_at DESC

Implementation Details

The query uses:

LEFT JOIN (
    SELECT t.project_id, MAX(ta.updated_at) as last_activity
    FROM tasks t
    INNER JOIN task_attempts ta ON ta.task_id = t.id
    GROUP BY t.project_id
) activity ON activity.project_id = p.id
ORDER BY activity.last_activity DESC NULLS LAST, p.created_at DESC

This approach:

  • Avoids direct GROUP BY on the main query which causes SQLx type inference issues
  • Uses NULLS LAST to ensure projects without activity appear after active ones
  • Preserves chronological ordering (newest first) for projects with no task attempts

This PR was written using Vibe Kanban

britannio avatar Dec 11 '25 11:12 britannio

when merge? need it.

isomoes avatar Jan 14 '26 23:01 isomoes