Friday, March 11, 2016

Upgrading moodle courses quiz settings in MySQL DB

My customer,


For all of these WEC courses , can we allow 2 Quiz attempts and remove the time completely from the Quizzes?

Thanks.


Digital Photography I - Siegel 1
Digital Photography I Brown
Digital Photography I Roborts
Digital Photography I - Seigel
Career Planning - Brown
Career Planning - Roborts
Career Planning - Rios
Introduction to Manufacturing Sec. 1 Sweeting
Introduction to Manufacturing Sec 2 Hanss
Introduction to Agriscience - Mintonye 1
Introduction to Agriscience - Mintonye

Translated, that means could you allow a second attempt for all the quizzes in the courses and remove the 1 hr time limit.

I remoted into the moodle DB using MySQL Workbench 5.2 CE and ran these two snippets of code - changing the course ids in each query.

Query one

#use this to remove time limits from quiz in multiple courses
UPDATE `dbname`.`mdl_quiz`
  

SET timelimit = 0  # a timelimit of 0 means no timing set - endless time to take the quiz
  

WHERE course in (course id list);

Query two

UPDATE `dbname`.`mdl_quiz`

 SET attempts = 2

 WHERE course in (course id list);


About 200 quizzes in 11 courses where updated at once, in two places [attempts, timelimit].  I could have updated both fields in the same query, since it was the same courses.

Imagine doing this from moodle.  It would take a couple hrs of very tedious work.




No comments:

Post a Comment