updating the number of sections of course page in Bulk

updating the number of sections of course page in Bulk

m question -
Number of replies: 6

Hi,


how to update the number of sections of all courses in Moodle which are already created?

I tried SA>Courses>Course default settings> number of sections

but that didn't affect the courses.


I tried to change it from database by executing the following 

UPDATE `mdl_course_format_options` SET `value`=15 WHERE `name`='numsetions' AND `courseid`=196 

the result was "0 rows affected"

I am sure there is course with course id 196, I want to try it in one course first before executing the following

UPDATE `mdl_course_format_options` SET `value`=15 WHERE `name`='numsetions' 

but it didn't work

how to change the sections?


Ngā whakawākanga toharite: -
In reply to m question

Re: updating the number of sections of course page in Bulk

Howard Miller -
Pikitia o Core developers Pikitia o Documentation writers Pikitia o Particularly helpful Moodlers Pikitia o Peer reviewers Pikitia o Plugin developers

What version of Moodle is this? This has changed in the latest (recent?) versions - topics are now added/deleted rather than there being a number

I definitely wouldn't access the database directly. 

Ngā whakawākanga toharite: -
In reply to Howard Miller

Re: updating the number of sections of course page in Bulk

m question -

Moodle 3.1.7

I have more than 200 courses that defualt format is Weeks and number of sections/Weeks 10

I want to change it to 15 for the courses

Ngā whakawākanga toharite: -
In reply to m question

Re: updating the number of sections of course page in Bulk

Edward Burke -

From the nAdministration Block choose Courses>Default course settings>Change sections to your desired number.  hope this helps

Ngā whakawākanga toharite: -
In reply to Edward Burke

Re: updating the number of sections of course page in Bulk

m question -

Thank you,

but this didn't affect the courses


the default course settings

Ngā whakawākanga toharite: -
In reply to Edward Burke

Re: updating the number of sections of course page in Bulk

Howard Miller -
Pikitia o Core developers Pikitia o Documentation writers Pikitia o Particularly helpful Moodlers Pikitia o Peer reviewers Pikitia o Plugin developers

Clue is in the name - 'default' - won't change existing ones. 

Ngā whakawākanga toharite: -
In reply to m question

Re: updating the number of sections of course page in Bulk

m question -

there was a small error in the sql in WHERE `name`='numsections' 

the correct one as follows:


to update the number of course sections for all courses to a specific value (15 in my case):

UPDATE `mdl_course_format_options` SET `value`=15 WHERE `name`='numsections' AND `courseid`<>1 and `format`='weeks'


I agree with Howard I don't recommend updating the database too, however, I needed fast solution
Ngā whakawākanga toharite: -