Exceptions due to jump in section number

Exceptions due to jump in section number

por Lea Cohen -
Number of replies: 2

In one of our courses, that uses the topcoll format, there are 7 sections: their id's are 1-6, and 110. Section 110 is an orphaned section, meaning that that in previous version of Moodle it didn't appear in the course since numsections is defined to be 6. In Moodle 3.3, the fact that the last section's id is not consecutive creates exceptions:

```

Notice: Trying to get property of non-object in /usr/share/nginx/html/aviv2017/course/format/topcoll/renderer.php on line 787

Notice: Trying to get property of non-object in /usr/share/nginx/html/aviv2017/course/format/topcoll/renderer.php on line 788

```

I get these exceptions for every id from 7 till 109.

When I change to any of the core course formats, such as topics or weeks, this doesn't happen.

I originally thought this was a problem with Moodle removing 'numsections' from version 3.3, and therefore posted on the Moodle development forum and even on tracker, but was told that this issue is related to the topcoll format.

I am using the 3.3.1.1 (2017042203) version of topcoll, on Moodle 3.3.

Average of ratings: -
In reply to Lea Cohen

Re: Exceptions due to jump in section number

por Gareth J Barnard -
Imaxe de Core developers Imaxe de Particularly helpful Moodlers Imaxe de Plugin developers

I have never ever seen a situation whereby the section number (not the section id as stored in the DB) was not consecutive, therefore must be an oddity with that course.  So add a new section underneath 6 to make 7, then move everything in 110 to 7, then delete 110.