Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-22936

Perform natural sort on groups and groupings


    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.9.9, 2.0
    • Fix Version/s: DEV backlog
    • Component/s: Groups
    • Labels:
    • Affected Branches:


      Groups and groupings are currently sorted using a basic alphanumeric sort (as the sorting is done by the DBMS), which fails to sort names with numbers in them correctly when the number of digits differs. For example, if you use the auto-create groups feature to create 20 groups using the naming scheme "Group #" it'll create "Group 1" through "Group 20" - but they'll appear in lists in the order "Group 1, Group 10, Group 11, ..., Group 19, Group 2, Group 20, Group 3, ..." which isn't ideal.

      I've attached patches against Moodle 1.9.9 and Moodle 2.0 (cvshead from git.moodle.org/moodle.git) which implement natural sorting on groups and groupings. I may have missed any places that they're listed outside the groups/groupings admin area, as I haven't done an exhaustive search of Moodle for lists of groups/groupings).

      Note that you won't be able to get to the Groupings or Overview tabs on 2.0 until MDL-22903 is resolved (unless you manually patch it), and that the list of groups assigned to the selected member in the group assignment list will not appear on 2.0 until MDL-22935 is resolved. These features will all still be sorted correctly by the attached patch.

        Gliffy Diagrams


            Issue Links



                • Votes:
                  8 Vote for this issue
                  6 Start watching this issue


                  • Created: