Signed-off-by: OpenClaw Bot <ai-agent@topdoglabs.com>
This commit is contained in:
parent
95060930b1
commit
bca83c682d
@ -42,6 +42,15 @@ const typeLabels: Record<string, string> = {
|
||||
plan: "📐",
|
||||
}
|
||||
|
||||
const UNSPRINTED_SENTINELS = new Set(["null", "none", "backlog", "unassigned", "no-sprint", "no_sprint"])
|
||||
|
||||
const normalizeSprintId = (value: string | undefined): string | undefined => {
|
||||
if (typeof value !== "string") return undefined
|
||||
const sprintId = value.trim()
|
||||
if (!sprintId) return undefined
|
||||
return UNSPRINTED_SENTINELS.has(sprintId.toLowerCase()) ? undefined : sprintId
|
||||
}
|
||||
|
||||
interface AssignableUser {
|
||||
id: string
|
||||
name: string
|
||||
@ -296,11 +305,16 @@ export function BacklogView() {
|
||||
const otherSprints = sprints.filter((s) => s.id !== currentSprint?.id)
|
||||
|
||||
// Get tasks by section
|
||||
const sprintIds = new Set(sprints.map((s) => s.id))
|
||||
|
||||
const currentSprintTasks = currentSprint
|
||||
? tasks.filter((t) => t.sprintId === currentSprint.id)
|
||||
? tasks.filter((t) => normalizeSprintId(t.sprintId) === currentSprint.id)
|
||||
: []
|
||||
|
||||
const backlogTasks = tasks.filter((t) => !t.sprintId)
|
||||
const backlogTasks = tasks.filter((t) => {
|
||||
const sprintId = normalizeSprintId(t.sprintId)
|
||||
return !sprintId || !sprintIds.has(sprintId)
|
||||
})
|
||||
|
||||
// Get active task for drag overlay
|
||||
const activeTask = activeId ? tasks.find((t) => t.id === activeId) : null
|
||||
@ -319,11 +333,12 @@ export function BacklogView() {
|
||||
const overId = over.id as string
|
||||
const overTask = tasks.find((t) => t.id === overId)
|
||||
|
||||
const overTaskSprintId = overTask ? normalizeSprintId(overTask.sprintId) : undefined
|
||||
const destinationId = overTask
|
||||
? overTask.sprintId
|
||||
? currentSprint && overTask.sprintId === currentSprint.id
|
||||
? overTaskSprintId
|
||||
? currentSprint && overTaskSprintId === currentSprint.id
|
||||
? "current"
|
||||
: `sprint-${overTask.sprintId}`
|
||||
: `sprint-${overTaskSprintId}`
|
||||
: "backlog"
|
||||
: overId
|
||||
|
||||
@ -395,7 +410,7 @@ export function BacklogView() {
|
||||
{otherSprints
|
||||
.sort((a, b) => new Date(a.startDate).getTime() - new Date(b.startDate).getTime())
|
||||
.map((sprint) => {
|
||||
const sprintTasks = tasks.filter((t) => t.sprintId === sprint.id)
|
||||
const sprintTasks = tasks.filter((t) => normalizeSprintId(t.sprintId) === sprint.id)
|
||||
console.log(`Sprint ${sprint.name}: ${sprintTasks.length} tasks`, sprintTasks.map(t => t.title))
|
||||
return (
|
||||
<SectionDropZone key={sprint.id} id={`sprint-${sprint.id}`}>
|
||||
|
||||
@ -477,8 +477,18 @@ const normalizeAttachments = (value: unknown): TaskAttachment[] => {
|
||||
.filter((attachment): attachment is TaskAttachment => attachment !== null)
|
||||
}
|
||||
|
||||
const UNSPRINTED_SENTINELS = new Set(['null', 'none', 'backlog', 'unassigned', 'no-sprint', 'no_sprint'])
|
||||
|
||||
const normalizeSprintId = (value: unknown): string | undefined => {
|
||||
if (typeof value !== 'string') return undefined
|
||||
const sprintId = value.trim()
|
||||
if (sprintId.length === 0) return undefined
|
||||
return UNSPRINTED_SENTINELS.has(sprintId.toLowerCase()) ? undefined : sprintId
|
||||
}
|
||||
|
||||
const normalizeTask = (task: Task): Task => ({
|
||||
...task,
|
||||
sprintId: normalizeSprintId(task.sprintId),
|
||||
comments: normalizeComments(task.comments),
|
||||
tags: Array.isArray(task.tags) ? task.tags.filter((tag): tag is string => typeof tag === 'string' && tag.trim().length > 0) : [],
|
||||
attachments: normalizeAttachments(task.attachments),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user