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

Deprecate max sections setting

XMLWordPrintable

    • MOODLE_500_STABLE
    • MOODLE_501_STABLE
    • MDL-84291-main-v03
    • Hide

      The general behaviour is tested with automated tests. However, the limits removal must be manually tested.

      The first test, which is a migration test, needs to be started without the patch.

      Test 01: migration test

      1. In an instance without this patch, login as admin.
      2. Go to "site administration -> courses -> Default settings -> Course default settings" and change the "Maximum number of sections" to 45.
      3. Apply the patch and proceed with the version upgrade.
      4. Go to "Site administration -> plugins -> Course formats -> Weekly sections"
        1. Check the "Maximum initial number of weeks" value is 45.

      The rest of tests have the patch already applied and the upgrade done so you can reuse the same instance.

      Test 02: check that there is no section limit in Custom sections

      1. Log in as admin and go to "site administration -> courses -> Default settings -> Course default settings" and:
        1. Change the "Maximum number of sections (deprecated)" to 5.
        2. Ensure the "Number of sections" is 4.
      2. Go to "site administration -> courses -> Add a new course" and set some valid values for the full name and the shortname
        1. Check in the form that when you expand the "course format" section the format field is "Custom sections" and that there is no field called "Number of sections".
      3. Click on "Save and display"
        1. Check the course has the General section and 4 more new sections.
      4. Turn on edit mode in the course page and create three new sections
        1. Check that now the course has the general section and 7 more sections
        2. Check that the "add section" element is still clickable

      Test 03: check that there is no section limit in Weekly sections

      1. Log in as admin and go to "Site administration -> plugins -> Course formats -> Weekly sections." Once there, set the "Maximum initial number of weeks" value to 45 (if it wasn't already).
      2. Go to "site administration -> courses -> Add a new course" and set some valid values for the full name and the shortname
      3. Expand the "course format" and set the format field to "Weekly sections" and wait for the page to reload
        1. Check that there is a field called "Number of sections" with a value 4 selected
        2. Click to expand the "Number of sections" options
          1. Check the max value is 45 (but keep the current value to 4).
      4. Click "Save and display"
        1. Check the course has one general section and 4 weekly sections.
      5. Turn on edit mode in the course page and create three new weeks
        1. Check that now the course has the general section and 7 more sections
        2. Check that the "add week" element is still clickable

      Test 04: course upload

      1. Login as admin and go to "site administration -> courses -> upload courses"
      2. Create a course using upload_courses.csv
      3. Go to the course
        1. Check the course has many sections (you don't need to count them, the numsection is set 80 so you only need to check there are a lot of sections)
      Show
      The general behaviour is tested with automated tests. However, the limits removal must be manually tested. The first test, which is a migration test, needs to be started without the patch. Test 01: migration test In an instance without this patch, login as admin. Go to "site administration -> courses -> Default settings -> Course default settings" and change the "Maximum number of sections" to 45. Apply the patch and proceed with the version upgrade. Go to "Site administration -> plugins -> Course formats -> Weekly sections" Check the "Maximum initial number of weeks" value is 45. The rest of tests have the patch already applied and the upgrade done so you can reuse the same instance. Test 02: check that there is no section limit in Custom sections Log in as admin and go to "site administration -> courses -> Default settings -> Course default settings" and: Change the "Maximum number of sections (deprecated)" to 5. Ensure the "Number of sections" is 4. Go to "site administration -> courses -> Add a new course" and set some valid values for the full name and the shortname Check in the form that when you expand the "course format" section the format field is "Custom sections" and that there is no field called "Number of sections". Click on "Save and display" Check the course has the General section and 4 more new sections. Turn on edit mode in the course page and create three new sections Check that now the course has the general section and 7 more sections Check that the "add section" element is still clickable Test 03: check that there is no section limit in Weekly sections Log in as admin and go to "Site administration -> plugins -> Course formats -> Weekly sections." Once there, set the "Maximum initial number of weeks" value to 45 (if it wasn't already). Go to "site administration -> courses -> Add a new course" and set some valid values for the full name and the shortname Expand the "course format" and set the format field to "Weekly sections" and wait for the page to reload Check that there is a field called "Number of sections" with a value 4 selected Click to expand the "Number of sections" options Check the max value is 45 (but keep the current value to 4). Click "Save and display" Check the course has one general section and 4 weekly sections. Turn on edit mode in the course page and create three new weeks Check that now the course has the general section and 7 more sections Check that the "add week" element is still clickable Test 04: course upload Login as admin and go to "site administration -> courses -> upload courses" Create a course using upload_courses.csv Go to the course Check the course has many sections (you don't need to count them, the numsection is set 80 so you only need to check there are a lot of sections)
    • Hide

      Code verified against automated checks with warnings.

      Checked MDL-84291 using repository: https://github.com/ferranrecio/moodle.git

      Should these errors be fixed?

      Built on: Mon May 12 14:10:20 UTC 2025

      Show
      Code verified against automated checks with warnings. Checked MDL-84291 using repository: https://github.com/ferranrecio/moodle.git main (0 errors / 1 warnings) [branch: MDL-84291-main-v02 | CI Job ] overview (0/0) , phplint (0/0) , phpcs (0/0) , js (0/0) , css (0/0) , phpdoc (0/0) , commit (0/1) , savepoint (0/0) , thirdparty (0/0) , externalbackup (0/0) , grunt (0/0) , shifter (0/0) , mustache (0/0) , gherkin (0/0) , Should these errors be fixed? Built on: Mon May 12 14:10:20 UTC 2025
    • Show
      Launching automatic jobs for branch MDL-84291 -main-v02 https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/19206/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/65662/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/65663/ Behat (Firefox - boost) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/65664/ Behat (Firefox - classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/65665/ App tests (stable app version) Built on: Tue May 6 12:30:19 UTC 2025
    • 3
    • HQ 2025 Sprint I2 Planning

      This issue is part of the course cleanup epic.

      The course max sections settings were introduced many years ago because the max number was hard-coded to 52 (the current default value) before that. However, having a section limit only introduces extra complexities to both the front end and back end when there is no good reason to limit in the first place.

      The situation worsens now that courses can use subsections. Finally, the decision to remove the setting is made.

      This issue is about:

      • Flag the course max sections as deprecated and leave it only for third-party format plugins
      • Deprecate any method to get the max section settings
      • Remove any use of max sections on core and core course formats.
      • Create a final deprecation issue for 6.0
      • Closes many max section-related issues opened, linking to this one.

        1. MDL-84291_Screenshot 2025-04-25 100251.png
          4 kB
          Gareth J Barnard
        2. uploadcourse1.csv
          0.1 kB
          Sara Arjona (@sarjona)
        3. upload_courses.csv
          0.1 kB
          Ferran Recio
        4. (2) 3 Passed -- (Main)MDL-84291.png
          49 kB
          Kim Jared Lucas
        5. (2) 4 Passed -- (Main)MDL-84291.png
          91 kB
          Kim Jared Lucas
        6. (4) 3 Passed -- (Main)MDL-84291.png
          68 kB
          Kim Jared Lucas
        7. (2) 2 Passed -- (Main)MDL-84291.png
          102 kB
          Kim Jared Lucas
        8. (3) 3 Passed -- (Main)MDL-84291.png
          87 kB
          Kim Jared Lucas
        9. (3) 4 Passed -- (Main)MDL-84291.png
          70 kB
          Kim Jared Lucas
        10. (3) 5 Passed -- (Main)MDL-84291.png
          78 kB
          Kim Jared Lucas

            tusefomal Ferran Recio
            tusefomal Ferran Recio
            Laurent David Laurent David
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            16 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 4 hours, 36 minutes
                1d 4h 36m

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