moodleou / moodle-mod_subpage

Subpage module allows you to add Moodle activities onto inner page within course
21 stars 15 forks source link

Inserting a section within course may co-opt a subpage section #6

Open emdalton opened 11 years ago

emdalton commented 11 years ago

One of our instructors had created a course with subpages in each topic; let's call them subpage1, subpage2, etc. She then inserted a new section between topic 1 and topic 2 in her course. Now subpage1 points to the new section and its contents. The old contents of subpage1 are still visible as "topic 16" at the end of the course.

This is Moodle 2.4, which allows new sections to be added to a course from the course page. It seems likely that there is a conflict in the logic that alters how many sections are visible in a course vs. orphaned when a new section is added from the main page, and the logic that creates and manages "orphaned" sections for each subpage.

Oddly, the instructor also inserted a new section between topic 2 and topic 3, and this did not seem to alter the contents of any of the subpages. However, in this case the extra content for Subpage2 is not in an orphaned section, but instead appears at the end of the course, but the section is set to be invisible.

sammarshallou commented 11 years ago

It is strange that this happened, but there are various similar things that can definitely happen. Basically, subpage uses sections that normally start from (I think) section 110 - you can configure this in the settings, but the idea is that you should pick a number that's more than you ever actually have real sections on a course main page. These may display as orphaned sections if you are using a course format that displays orphaned sections.

Sections are actually 'linked' to a subpage by their internal id, not by their section number. For example, even though the first subpage is using section number 110, it will refer to it by its id which might be 11462 for example. So even if you insert a section and Moodle renumbers section 110 to section 111 because one was inserted, this shouldn't change its id, so the subpage should still own that section.

The only thing I can think of is that maybe Moodle somehow, instead of renumbering the existing sections when you inserted one, actually moved all the items from each section (11462 in this example) into a different section. That seems crazy - it would be difficult to code and I think it would cause other problems - but I suppose it's possible. (If it does happen, we can't fix it within subpage - vote for MDL-37702 if you'd like to increase the chance that subpage-like modules are properly possible in core Moodle at some point, which would allow us to fix all the weird behaviour.)

If you came up with steps to reproduce this starting from a new blank course, that might be useful to clarify the issue, but I suspect we might not be able to fix it anyhow...