Deck: Update to v1.0.0 disarranges stack order of existing boards

Created on 6 May 2020  路  12Comments  路  Source: nextcloud/deck

After updating Deck App to v1.0.0 today (from the latest previous release) using the Web backend the order of my existing board's stacks has been disarranged and had to be resorted manually.

Anyway, thanks a lot for this great update!

1. to develop bug

All 12 comments

In my case the stacks were sorted alphabetically after the update

Could you please fill out the issue template with details about your setup? Especially what kind of database you are using?

Sorry for the late response: We're using a docker installation of Nextcloud with PostgreSQL 11

@Chartman123 I currently don't have a running postgres instance but could you maybe check if the following patch fixes the issue?

diff --git a/lib/Db/StackMapper.php b/lib/Db/StackMapper.php
index 199c3fd5..40d01929 100644
--- a/lib/Db/StackMapper.php
+++ b/lib/Db/StackMapper.php
@@ -49,7 +49,7 @@ class StackMapper extends DeckMapper implements IPermissionMapper {


        public function findAll($boardId, $limit = null, $offset = null) {
-               $sql = 'SELECT * FROM `*PREFIX*deck_stacks` WHERE `board_id` = ? AND deleted_at = 0 ORDER BY `order`';
+               $sql = 'SELECT * FROM `*PREFIX*deck_stacks` WHERE `board_id` = ? AND deleted_at = 0 ORDER BY `order`, `id`';
                return $this->findEntities($sql, [$boardId], $limit, $offset);
        }

@juliushaertl Will this patch make any difference as I'm already on the latest version of the Deck app?

Yes, it is not merged yet, just a guess what could work from looking at the code. :wink:

SQL (but especially PostgreSQL) does not guarantee ordered results unless specified. In case your stacks never got rearanged manually by yourself, it might happen that they all have the order column set to 0 and with this patch it would take the incremental id as a second sorting parameter.

I meant because I already re-ordered them manually. So I don't know exactly what to do to trigger the behavior again and see if it's gone after the patch.

Ah then it could maybe not have any effect anymore. But maybe you can try to create a new board, add some stacks without touching their order and then force refresh the page and see if they still come up in a different order.

Ok, I'll try this tomorrow :+1:

Couldn't wait... :slightly_smiling_face: So, I tried to do it that way, but wasn't able to reproduce the wrong order. The stacks are always in the correct order. Perhaps it has something to do with the database update from 11 to 12...

But yes, I think your change should fix the problem. I could see in the respone JSON from the server, that the order is 999 for all stacks if you didn't change the order manually. :+1:

Maybe we fixed that somewhere on the way from 1.0.0 to 1.0.2 somewhere in the frontend :grin:

I could see in the respone JSON from the server, that the order is 999 for all stacks if you didn't change the order manually.

Good that would also be a hint into the same direction :+1:

Anyway let's still add that change since it makes sense to have the cards properly presorted. Thanks a lot for the quick testing.

Should have been fixed by #2032

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Dubidubiduu picture Dubidubiduu  路  3Comments

fkaup picture fkaup  路  4Comments

ampoz picture ampoz  路  4Comments

armaccloud picture armaccloud  路  3Comments

reox picture reox  路  4Comments