From 0c411fd1e99cb74fa269d32ad102f4aab784d6de Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 6 Jun 2024 16:22:51 +0200 Subject: [PATCH] fix(kanban): remove leftovers of kanban_position property This might fix a bug where the kanban position would not be saved correctly. --- .../src/components/project/views/ProjectKanban.vue | 10 +++++----- frontend/src/modelTypes/ITask.ts | 1 - frontend/src/models/task.ts | 1 - frontend/src/services/taskCollection.ts | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/project/views/ProjectKanban.vue b/frontend/src/components/project/views/ProjectKanban.vue index b3233758c..61b205db9 100644 --- a/frontend/src/components/project/views/ProjectKanban.vue +++ b/frontend/src/components/project/views/ProjectKanban.vue @@ -486,8 +486,8 @@ async function updateTaskPosition(e) { const newTask = klona(task) // cloning the task to avoid pinia store manipulation newTask.bucketId = newBucket.id const position = calculateItemPosition( - taskBefore !== null ? taskBefore.kanbanPosition : null, - taskAfter !== null ? taskAfter.kanbanPosition : null, + taskBefore !== null ? taskBefore.position : null, + taskAfter !== null ? taskAfter.position : null, ) if ( oldBucket !== undefined && // This shouldn't actually be `undefined`, but let's play it safe. @@ -525,13 +525,13 @@ async function updateTaskPosition(e) { } // Make sure the first and second task don't both get position 0 assigned - if (newTaskIndex === 0 && taskAfter !== null && taskAfter.kanbanPosition === 0) { + if (newTaskIndex === 0 && taskAfter !== null && taskAfter.position === 0) { const taskAfterAfter = newBucket.tasks[newTaskIndex + 2] ?? null const newTaskAfter = klona(taskAfter) // cloning the task to avoid pinia store manipulation newTaskAfter.bucketId = newBucket.id - newTaskAfter.kanbanPosition = calculateItemPosition( + newTaskAfter.position = calculateItemPosition( 0, - taskAfterAfter !== null ? taskAfterAfter.kanbanPosition : null, + taskAfterAfter !== null ? taskAfterAfter.position : null, ) await taskStore.update(newTaskAfter) diff --git a/frontend/src/modelTypes/ITask.ts b/frontend/src/modelTypes/ITask.ts index 7dd9a100e..6230f80b3 100644 --- a/frontend/src/modelTypes/ITask.ts +++ b/frontend/src/modelTypes/ITask.ts @@ -45,7 +45,6 @@ export interface ITask extends IAbstract { subscription: ISubscription position: number - kanbanPosition: number reactions: IReactionPerEntity diff --git a/frontend/src/models/task.ts b/frontend/src/models/task.ts index 2e2f1095a..b8b0d3af4 100644 --- a/frontend/src/models/task.ts +++ b/frontend/src/models/task.ts @@ -85,7 +85,6 @@ export default class TaskModel extends AbstractModel implements ITask { subscription: ISubscription = null position = 0 - kanbanPosition = 0 reactions = {} diff --git a/frontend/src/services/taskCollection.ts b/frontend/src/services/taskCollection.ts index ec97fe868..a16a8c92e 100644 --- a/frontend/src/services/taskCollection.ts +++ b/frontend/src/services/taskCollection.ts @@ -5,7 +5,7 @@ import type {ITask} from '@/modelTypes/ITask' import BucketModel from '@/models/bucket' export interface TaskFilterParams { - sort_by: ('start_date' | 'end_date' | 'due_date' | 'done' | 'id' | 'position' | 'kanban_position')[], + sort_by: ('start_date' | 'end_date' | 'due_date' | 'done' | 'id' | 'position')[], order_by: ('asc' | 'desc')[], filter: string, filter_include_nulls: boolean,