Signed-off-by: Max <ai-agent@topdoglabs.com>
This commit is contained in:
parent
ab8cc0a6a1
commit
6cdd584b82
@ -309,7 +309,14 @@ export function BacklogView({ searchQuery = "" }: BacklogViewProps) {
|
||||
// Get current active sprint
|
||||
// Treat end date as end-of-day (23:59:59) to handle timezone issues
|
||||
const now = new Date()
|
||||
const currentSprint = sprints.find((s) => {
|
||||
const projectSprints = selectedProjectId
|
||||
? sprints.filter((s) => s.projectId === selectedProjectId)
|
||||
: sprints
|
||||
const projectTasks = selectedProjectId
|
||||
? tasks.filter((t) => t.projectId === selectedProjectId)
|
||||
: tasks
|
||||
|
||||
const currentSprint = projectSprints.find((s) => {
|
||||
if (s.status !== "active") return false
|
||||
const sprintStart = parseSprintStart(s.startDate)
|
||||
const sprintEnd = parseSprintEnd(s.endDate)
|
||||
@ -317,20 +324,20 @@ export function BacklogView({ searchQuery = "" }: BacklogViewProps) {
|
||||
})
|
||||
|
||||
// Get other sprints (not current)
|
||||
const otherSprints = sprints.filter((s) => s.id !== currentSprint?.id)
|
||||
const otherSprints = projectSprints.filter((s) => s.id !== currentSprint?.id)
|
||||
|
||||
// Sort tasks by updatedAt (descending) - latest first
|
||||
const sortByUpdated = (a: Task, b: Task) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()
|
||||
|
||||
// Get tasks by section (sorted by last updated)
|
||||
const currentSprintTasks = currentSprint
|
||||
? tasks.filter((t) => t.sprintId === currentSprint.id && matchesSearch(t)).sort(sortByUpdated)
|
||||
? projectTasks.filter((t) => t.sprintId === currentSprint.id && matchesSearch(t)).sort(sortByUpdated)
|
||||
: []
|
||||
|
||||
const backlogTasks = tasks.filter((t) => !t.sprintId && matchesSearch(t)).sort(sortByUpdated)
|
||||
const backlogTasks = projectTasks.filter((t) => !t.sprintId && matchesSearch(t)).sort(sortByUpdated)
|
||||
|
||||
// Get active task for drag overlay
|
||||
const activeTask = activeId ? tasks.find((t) => t.id === activeId) : null
|
||||
const activeTask = activeId ? projectTasks.find((t) => t.id === activeId) : null
|
||||
|
||||
const handleDragStart = (event: DragStartEvent) => {
|
||||
setActiveId(event.active.id as string)
|
||||
@ -344,7 +351,7 @@ export function BacklogView({ searchQuery = "" }: BacklogViewProps) {
|
||||
|
||||
const taskId = active.id as string
|
||||
const overId = over.id as string
|
||||
const overTask = tasks.find((t) => t.id === overId)
|
||||
const overTask = projectTasks.find((t) => t.id === overId)
|
||||
|
||||
const destinationId = overTask
|
||||
? overTask.sprintId
|
||||
@ -418,8 +425,7 @@ export function BacklogView({ searchQuery = "" }: BacklogViewProps) {
|
||||
{otherSprints
|
||||
.sort((a, b) => parseSprintStart(a.startDate).getTime() - parseSprintStart(b.startDate).getTime())
|
||||
.map((sprint) => {
|
||||
const sprintTasks = tasks.filter((t) => t.sprintId === sprint.id && matchesSearch(t)).sort(sortByUpdated)
|
||||
console.log(`Sprint ${sprint.name}: ${sprintTasks.length} tasks`, sprintTasks.map(t => t.title))
|
||||
const sprintTasks = projectTasks.filter((t) => t.sprintId === sprint.id && matchesSearch(t)).sort(sortByUpdated)
|
||||
return (
|
||||
<SectionDropZone key={sprint.id} id={`sprint-${sprint.id}`}>
|
||||
<TaskSection
|
||||
|
||||
Loading…
Reference in New Issue
Block a user