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

Deleted sections reappear when moving sections

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.6
    • Fix Version/s: None
    • Component/s: Course
    • Labels:
      None
    • Environment:
      All
    • Database:
      Any
    • Affected Branches:
      MOODLE_16_STABLE

      Description

      Moodle never really deletes a section from the database. This is probably a good thing. Otherwise a teacher could lose part of the course by accidently setting the number of sections too low.

      One of our teachers, however, was trying to convert a weekly format course with 44 sections into a topics format class with only 6 sections. He made the necessary changes in course settings and everything looked fine. Yet whenever he tried to move a section, all 44 sections would show up again.

      I searched the code and found that the move_section() function in course/lib.php does a Check for duplicates (line 1679). This resets numsections to the total number of sections in the database (line 1690). When I commented out the entire duplicate check (lines 1681-1693), the issue went away.

      How necessary is the duplicate section number check? The comment says it is for a very rare case. Could the code just be removed or should it be rewritten?

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: