Moodle

Deleted sections reappear when moving sections

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Trivial Trivial
  • Resolution: Unresolved
  • 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?

Issue Links

Activity

Hide
Michael de Raadt added a comment -

Thanks for reporting this issue.

We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported.

If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

Michael d;

lqjjLKA0p6

Show
Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d; lqjjLKA0p6
Hide
Daniel Neis added a comment -

Hello, Michael

i've tested this locally with a weekly course and this does not occur anymore in 2.2.1
The source code for move_section() and move_section_to() does not change the value of numsections.

HTH,
Daniel

ps.: could you take a look at MDL-10405 ? I've submitted a patch sometime ago and it is the 17th most voted issue on tracker Thanks!

Show
Daniel Neis added a comment - Hello, Michael i've tested this locally with a weekly course and this does not occur anymore in 2.2.1 The source code for move_section() and move_section_to() does not change the value of numsections. HTH, Daniel ps.: could you take a look at MDL-10405 ? I've submitted a patch sometime ago and it is the 17th most voted issue on tracker Thanks!

People

Vote (1)
Watch (3)

Dates

  • Created:
    Updated: