General help

updating the number of sections of course page in Bulk

 
myname
updating the number of sections of course page in Bulk
 

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?


 
Average of ratings: -
Picture of Howard Miller
Re: updating the number of sections of course page in Bulk
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup 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. 

 
Average of ratings: -
myname
Re: updating the number of sections of course page in Bulk
 

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

 
Average of ratings: -
Picture of Edward Burke
Re: updating the number of sections of course page in Bulk
 

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

 
Average of ratings: -
myname
Re: updating the number of sections of course page in Bulk
 

Thank you,

but this didn't affect the courses


the default course settings

 
Average of ratings: -
Picture of Howard Miller
Re: updating the number of sections of course page in Bulk
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers

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

 
Average of ratings: -
myname
Re: updating the number of sections of course page in Bulk
 

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
 
Average of ratings: -