Projects DB table, "position" column odd values

Hello! Thanks x1000 for a really fabulous tool! I’ve set up a server and installed on linux via DEB, with Postgres as the backend, and I’m using Vivaldi as my default browser.

I could not reorder projects, but it turns out this is a bug related to Vivaldi & assigning colors to projects, oddly enough, per another article I found her entitled something like “Drag and drop projects in left column”. Sadly, I was not clever enough to do this search before poking around in the DB.

I looked at the “position” values in the Projects table and found that they indeed correlated to the GUI ordering, despite being large, non consecutive values where I expected “1, 2, 3, 4…”. But I swapped two values and found that they indeed affected the GUI layout.

But, when I then used Firefox to be able to drag & drop the project order, the position column now contains odd fractional values where before it was all integers.

Is this normal, or have I really “borked” the database? There’s no obvious ill effect, yet…

Thanks again for Vikunja, and thanks in advance for any advice re: my database issue.

FYI, DB table:
vikunja=# select id, title, owner_id, position from projects where owner_id =2 order by position;

id title owner_id position
12 Comm Planning 2 589824
4 00 - Inbox 2 429496729.6
10 M & J 2 858993459.2
6 Facilities 2 1288490188.8000002
13 HR 2 1717986918.4
11 IT 2 2147483648
15 ML Policy 2 2576980377.6000004
16 Seasonal 2 3006477107.2000003
(8 rows)

Thanks for the kind words!

The fractions are intended. We’re using these big numbers to easily allow reordering - if we’d only had numbers in normal order like 1,2,3,4,5 we’d need to change every position of every task when moving a task between two other tasks. With these large numbers, the algorithm is as follows:

  1. If we have three tasks: T1 (position 0), T2 (50), T3 (100)
  2. When moving T1 between T2 and T3, the position is calculated as (50 + 100) / 2 = 75
  3. T1 gets 75 assigned as new position

This is a much more efficient since we only need to update the tasks that we’re moving, not every other task as well.

The fractions are just there so that we can use many more values.

The algorithm is the same as what Trello and others are using.