fix(sort-order): decouple sprint membership actions from sort_order
createSprintAction and addStoryToSprintAction no longer write sort_order when adding stories to a sprint. sort_order is derived from code via parseCodeNumber, so membership should only set sprint_id + status. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
fec03dd257
commit
86692f8e31
1 changed files with 2 additions and 7 deletions
|
|
@ -440,7 +440,7 @@ export async function createSprintAction(_prevState: unknown, formData: FormData
|
|||
...stories.map((s, i) =>
|
||||
prisma.story.update({
|
||||
where: { id: s.id },
|
||||
data: { sprint_id: sprint.id, status: 'IN_SPRINT', sort_order: i + 1 },
|
||||
data: { sprint_id: sprint.id, status: 'IN_SPRINT' },
|
||||
}),
|
||||
),
|
||||
prisma.task.updateMany({
|
||||
|
|
@ -531,14 +531,9 @@ export async function addStoryToSprintAction(sprintId: string, storyId: string)
|
|||
if (!story) return { error: 'Story niet gevonden' }
|
||||
if (story.product_id !== sprint.product_id) return { error: 'Story hoort niet bij deze Sprint' }
|
||||
|
||||
const last = await prisma.story.findFirst({
|
||||
where: { sprint_id: sprintId },
|
||||
orderBy: { sort_order: 'desc' },
|
||||
})
|
||||
|
||||
await prisma.story.update({
|
||||
where: { id: storyId },
|
||||
data: { sprint_id: sprintId, status: 'IN_SPRINT', sort_order: (last?.sort_order ?? 0) + 1.0 },
|
||||
data: { sprint_id: sprintId, status: 'IN_SPRINT' },
|
||||
})
|
||||
|
||||
revalidatePath(`/products/${sprint.product_id}/sprint`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue