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

Order filter #138

Open
jesusman111 opened this issue Aug 17, 2020 · 5 comments
Open

Order filter #138

jesusman111 opened this issue Aug 17, 2020 · 5 comments
Assignees

Comments

@jesusman111
Copy link

Hello again:

When I use filters it doesn't sort the fields correctly.

In the screenshot you can see that the course 2029-2030 appears in second place and should be the first.

Thanks for everything

order

@michaelpollak michaelpollak self-assigned this Aug 24, 2020
@michaelpollak
Copy link
Collaborator

michaelpollak commented Aug 24, 2020

Thank you for this report, I have just tested it and you are right. I can reproduce the strange behavior... Will check out what the database query in the background seems to do and keep you updated. Expected behavior is:

2020-2021
2024-2025
2029-2030

@michaelpollak
Copy link
Collaborator

For reference, the error is introduced in the chained replace algorithm. We produce this sort query:
REPLACE(REPLACE(REPLACE(c476.content,'1', '2002'),'2', '2003'),'3', '2001') ASC

in filter_class.php:416

michaelpollak added a commit to michaelpollak/moodle-mod_datalynx that referenced this issue Aug 24, 2020
@michaelpollak
Copy link
Collaborator

Bug is introduced only in single select fields bc. we don't use # as a spacer there. In the replace this messes up, the query above leads to the following occurence: 1 -> 2002 -> 2003003 -> 2002001002001 which is obviously not intended.

To fix this I extended the algorithm to use REGEXP_REPLACE and check if we are at a later iteration or definitely at the first stage where 1 is neither prepended nor followed by anything. Assuming David likes this solution it will be rolled out with the next release.

Thanks again for your reports, datalynx becomes better because of you.

@jesusman111
Copy link
Author

Is the error of correct alphabetical ordering already solved?

Very interesting improvements have been made to Datalynx lately.

Do you know when the next update will be released?

Thanks for everything

@michaelpollak
Copy link
Collaborator

This is fixed but it's hard to tell when we release the next version. Sorry for that, a lot of things get done behind the scene and our project lead is very busy :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants