ndunand / moodle-mod_choicegroup

Moodle "Group Choice" plugin
https://moodle.org/plugins/mod_choicegroup
35 stars 64 forks source link

Adding conditional CAST on SORT BY when ordering by group name #221

Closed Benjamin-unige closed 1 month ago

Benjamin-unige commented 1 month ago

When ordering groups by name the sorting is done alphabetically and would place "group 12" before "group 2" This patch does a CAST to UNSIGNED on the numbers in a group name to fix that

ndunand commented 1 month ago

Hi @Benjamin-unige ,

Thanks for suggesting this and providing a fix. I'm wondering though, what is the general expected behavior in this case? Would sorting in the mod_choicegroup module not behave differently as in other parts of Moodle?

Benjamin-unige commented 1 month ago

Hi @ndunand ,

My initial motivation for this edit was a teacher asking us why when they were sorting group by name it was "all messed up" but I see your point.

I'll see if I can submit a similar patch on moodle core

NicoAlexH commented 1 month ago

Hi @Benjamin-unige ! We discussed the matter with @ndunand and we decided to merge your PR, as this behaviour makes more sense in the end (even if it might be different in other parts of Moodle). Thanks for the fix! It will be available in the next release :)