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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.9.3
    • Fix Version/s: None
    • Component/s: Course
    • Labels:
      None
    • Environment:
      all environments
    • Database:
      Any
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_19_STABLE

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              moodle.com moodle.com
              Reporter:
              gavinmc Gavin Mccullagh
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              5 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: