From 81e1811560a1720966378767e7fadefd442df6af Mon Sep 17 00:00:00 2001 From: Miguel Gonzalez Date: Tue, 31 Jul 2018 23:14:28 +0200 Subject: [PATCH] fix: Set after destination order when no previous US --- app/coffee/modules/kanban/kanban-usertories.coffee | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/coffee/modules/kanban/kanban-usertories.coffee b/app/coffee/modules/kanban/kanban-usertories.coffee index ea4cfc14..891f0c16 100644 --- a/app/coffee/modules/kanban/kanban-usertories.coffee +++ b/app/coffee/modules/kanban/kanban-usertories.coffee @@ -132,6 +132,15 @@ class KanbanUserstoriesService extends taiga.Service else if !previous startIndex = 0 + + for it, key in afterDestination # increase position of the us after the dragged us's + @.order[it.id] = key + initialLength + 1 + it.kanban_order = @.order[it.id] + + setNextOrders = _.map(afterDestination, (it) => + {us_id: it.id, order: @.order[it.id]} + ) + else if previous startIndex = @.order[previous.id] + 1