changing activities from resources to quizzes moving completion / grades

changing activities from resources to quizzes moving completion / grades

by Rob Powell -
Number of replies: 1

Good morning,

I am working in moodle 2.6.  We had a course set up with multiple resources which were considered complete when a user clicked and viewed them.  It was decided, after go live, that the course needs a more rigid workflow and we moved over to quizzes.  Now, new users who take the course will see the quizzes and we can track completion, progress, and grades.  Issue is, what to do with the users who have already completed the course when the activities were resources?  It was decided that the old users should be tracked as complete for the new activities.... yay wide eyes!

I came up with a two pronged approach, SQL inserts for both mdl_course_modules_completion and mdl_quiz_grades. This will handle the completion criteria and the grades for the new quizzes.  

Here is the sql for mdl_quiz_grades

insert into mdl_quiz_grades (id, quiz, userid, grade, timemodified)

SELECT '',

id "quiz",

 389 "userid",

 5.00000 "grade",

 UNIX_TIMESTAMP(CURDATE()) "timemodified"

from mdl_quiz

where course= 30


here is the sql for mdl_course_modules_completion


insert into mdl_course_modules_completion (id, coursemoduleid, userid, completionstate, viewed, timemodified)
SELECT '',
  id,
  389 userid,
  1 completionstate,
  1 viewed,
  UNIX_TIMESTAMP(CURDATE()) timemodified
FROM mdl_course_modules cm
WHERE cm.course =30
AND cm.module =16
AND id between 204 and 214

Now the issue is, while completion is being tracked the grades are not.  

activity completion report quizzes are complete

I have seen some posts about using the gradebook API, however I do not understand the changes needed from the example to do what I need.  If someone could give me more information on how to complete this either via sql or API, that would be much appreciated.


Thanks!

Average of ratings: -
In reply to Rob Powell

Re: changing activities from resources to quizzes moving completion / grades

by Rob Powell -

hello, any thoughts on this? admins, if you think there is a better forum section for this topic please let me know and I'll go there.