Custom sorting not working

Hi community,

I got Vikunja to work on my Synology a few weeks ago and love the app!

One thing I would like to do, is custom sorting the tasks I created. In a List I can drag and drop the tasks but after reloading the page, or moving to another List and back, the original order is shown.

Apart from that, is it possible to custom sort tasks on the Upcoming view?

When testing it again right now, I realized that I am able to sort tasks in a new list. However, after a few minutes, the sorting is not consistent anymore.

Example:

  • Want to sort tasks in list “General” → not working
  • Create new list “Test” with dummy entries → sorting works
  • Create new Namespace “general” and duplicate list “General” into namespace “general” → sorting works
  • wait a few minutes → sorting stops working in list “general” and in list “Test” as well

Did anybody encounter an error like this in the past?
I am using vikunja on Brave, where the api and frontend are running in Docker containers in my Synology.

Best regards,
Fabian

That’s not possible right now.

I was unable to reproduce this. Can you check if it works on try?

Thanks for the reply!

On try.vikunja.io I have the exact same behavior. Tried it on Android with Chromium and iPhone with Safari. I didn’t connect to my own backend.

Here is a screen record from the iphone test (sorry for the music xD)

I stumbled across this too.

If you look at the tasks with curl (or vja :slight_smile: ) you will find that a lot of tasks have their attributes position and kanban_position set to 0.

It seems that the algorithm for moving a task within a list assigns its new position/kanban_position to a value between the upper and the lower task which is 0 between 0 and 0 and thus will be ignored.

The current algorithm will soon fill up un-movebale position 0-tasks as long as Vikunja emits positions as 0 for new tasks and accepts 0 from other clients like caldav.

I noticed that as well. I tried fixing this in the past with a check in the frontend where it would update the next task as well when it had a position of 0. That works as long as there are not that many tasks with this problem. At some point, most of the tasks have a position of 0 and this naive correction method won’t work anymore.

I’ve just pushed a fix for this in 1efa1696bf. The api will now recalculate the position of all tasks when it notices the position of the current task is < 0.1. The position attribute might not be correct for all items in the frontend after that, but the positions will stay the same after reloading.
Please check with the next unstable build (~45 min on try) if the problem went away.

Do the recalculateTaskPositions() operations iterate the existing tasks ordered by their position? If not then any existing order would be shuffled, anytime an incoming task without position comes in.
(Sorry if I’m wrong, I am not very ‘gone’ yet to fully understand the go code.)

Good catch! Should be fixed with ca6d1946da.

Awesome, thank you for the fix!
It seems to work properly on try.vikunja.io