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

Size of Moodle Course Category Edit Page Scales as the square of the number of Categories

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • None
    • 1.9.3
    • Course
    • None
    • all environments
    • Any
    • MOODLE_19_STABLE
    • Moderate

      Hi,

      we have 408 course categories in Moodle just now. This is arranged in a hierarchy of 20 "faculty" categories with "course" categories underneath each. The course category page at:

      course/index.php?categoryedit=on

      is now 25MB of HTML with editing turned on. This is way too slow to load and very slow to use. The reason is that for each category (N), an option list is created of (N) categories. So you have N^2 options on the page.

      numoptions(numcat) = (numcat)^2

      We have 408 categories.

      408*408 = 166464

      gavinmc@ceartgoleor:~$ grep -i '<option' /tmp/index.php | wc -l
      166079

      I ran into a problem like this some years ago. The solution we used was to create a single javascript function called printoptions() which printed the option list. Then, everywhere it was needed, you just called the javascript function. To make sure you get the right option pre-selected, you can either place a single duplicate entry manually with <option .... selected> before you call the javascript or you can make the javascript function a little smarter so you can pass the value selected to it.

      This would scale linearly instead of as a square of the number of categories.

      What do people think of this solution? My time is a little short but if need be I can try and find time to work out a patch for this. If you guys would rather implement it that's fine too.

      Gavin

            moodle.com Moodle HQ
            gavinmc Gavin Mccullagh
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.