Auto-detect current sprint based on date range regardless of status

This commit is contained in:
Max 2026-02-24 13:32:44 -06:00
parent 25fa76e59d
commit 72b77a5e57

View File

@ -629,10 +629,18 @@ export default function Home() {
}, [selectedTask]) }, [selectedTask])
// Get current sprint (across all projects) using local-day boundaries. // Get current sprint (across all projects) using local-day boundaries.
// Prioritize date matching - if today falls within sprint dates, it's current
const now = new Date() const now = new Date()
const sprintsInProgress = sprints.filter((s) => isSprintInProgress(s.startDate, s.endDate, now))
// First: prefer active sprints that are in date range
// Second: any sprint in date range (not completed)
// Third: any sprint in date range (even if completed, for edge cases)
const currentSprint = const currentSprint =
sprints.find((s) => s.status === "active" && isSprintInProgress(s.startDate, s.endDate, now)) ?? sprintsInProgress.find((s) => s.status === "active") ??
sprints.find((s) => s.status !== "completed" && isSprintInProgress(s.startDate, s.endDate, now)) sprintsInProgress.find((s) => s.status !== "completed") ??
sprintsInProgress[0] ??
null
// Filter tasks to only show current sprint tasks in Kanban (from ALL projects) // Filter tasks to only show current sprint tasks in Kanban (from ALL projects)
// Sort by updatedAt descending (latest first) // Sort by updatedAt descending (latest first)