Section extraction bugfix

The number of the extracted sections was wrong because of how
moodle treats the adding and removing of the sections.
The sections are not deleted from the db when the number
of the sections is changed in the settings of the course.
So using the data directly from the db is wrong because
the number of sections extracted from the db doesn't always
equal the number of the sections chosen in the course settings.