Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buggy sorting logic when reordering levels in levelpack admin #732

Open
makitalo opened this issue Jan 6, 2025 · 0 comments
Open

Buggy sorting logic when reordering levels in levelpack admin #732

makitalo opened this issue Jan 6, 2025 · 0 comments
Labels
bug Something wrong with existing feature

Comments

@makitalo
Copy link
Collaborator

makitalo commented Jan 6, 2025

Steps to reproduce:

1. Add some levels to a new pack: Lost01, Lost05, Lost02, Lost03, Lost04

How levelpack_level looks now:

LevelName,Sort
Lost01,111121111111111111111111111111111111
Lost05,111131111111111111111111111111111111
Lost02,111141111111111111111111111111111111
Lost03,111151111111111111111111111111111111
Lost04,111161111111111111111111111111111111

Everything looks as expected. ✔️
But I want to move Lost02, Lost03 and Lost04 up on the list. (In reality, there might already be 100 levels in the pack before we added Lost02, Lost03 and Lost04, so just moving Lost05 down is not an option.)

2. Drag Lost02 inbetween Lost01 and Lost05

LevelName,Sort
Lost01,111121111111111111111111111111111111
Lost02,11112i111111111111111111111111111111
Lost05,111131111111111111111111111111111111
Lost03,111151111111111111111111111111111111
Lost04,111161111111111111111111111111111111

So far so good. ✔️

3a. Force refresh the page to work around #654 (doesn't change anything in the db)
3b. Drag Lost03 inbetween Lost02 and Lost05

LevelName,Sort
Lost01,111121111111111111111111111111111111
Lost03,11112a111111111111111111111111111111
Lost02,11112i111111111111111111111111111111
Lost05,111131111111111111111111111111111111
Lost04,111161111111111111111111111111111111

Hold on, Lost03 and Lost02 are the wrong way around now. ❌

4a. Ok, let's try to fix it. Force refresh the page again.
4b. Drag Lost02 inbetween Lost01 and Lost03

LevelName,Sort
Lost01,111121111111111111111111111111111111
Lost02,111126111111111111111111111111111111
Lost03,11112a111111111111111111111111111111
Lost05,111131111111111111111111111111111111
Lost04,111161111111111111111111111111111111

Well, that worked. ✔️

5a. We still want to get Lost04 where it belongs though. Force refresh once again.
5b. Drag Lost04 inbetween Lost03 and Lost05

LevelName,Sort
Lost01,111121111111111111111111111111111111
Lost02,111126111111111111111111111111111111
Lost04,111126111111111111111111111111111111
Lost03,11112a111111111111111111111111111111
Lost05,111131111111111111111111111111111111

That's incorrect again. Now Lost04 has the same Sort string as Lost02. ❌

6a. Maybe I can fix it again second try. Force refresh.
6b. Drag Lost03 inbetween Lost02 and Lost04

LevelName,Sort
Lost03,000011111111111111111111111111111111
Lost01,111121111111111111111111111111111111
Lost02,111126111111111111111111111111111111
Lost04,111126111111111111111111111111111111
Lost05,111131111111111111111111111111111111

Nope, now somehow Lost03 ends up in the very first place. ❌

Further reordering attempts won't work after this point, Lost03 just gets thrown to the last place with i11111111111111111111111111111111111 or to the first place with 000011111111111111111111111111111111.

@makitalo makitalo added the bug Something wrong with existing feature label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something wrong with existing feature
Projects
None yet
Development

No branches or pull requests

1 participant