Best practice forum (Archived)

mdl_course_modules_completion vs mdl_course_completions tables

 
Wen Hao Chuang
mdl_course_modules_completion vs mdl_course_completions tables
by Wen Hao Chuang - Friday, 23 October 2015, 8:17 AM
 

Dear all, sorry for a technical question. We are running 2.5.30 now.

We accidentally found that in our DB, there are some specific users who have records in the mdl_course_modules_completion table, but NOT the corresponding mdl_course_completions table. How could that be possible though? Can anyone think of any scenario how such case would happen?

This is what we understand. The mdl_course_modules_completion table won't have a record until the user started any module (Moodle activities/resources) inside of a course. Also, the mdl_course_completions won't have any record, until a user has clicked on "launch course" button. If this is true, then how would it be possible when one started some activities/resources inside of a course already, but not yet clicked on the "launch course" button? Any reasonable explanation aobut such case? Thanks!

Sam Hemelryk
Re: mdl_course_modules_completion vs mdl_course_completions tables
by Sam Hemelryk - Friday, 23 October 2015, 8:32 AM
Group Totara

Hi Wen,

Have the users had access to the course in the past?

We are aware of a bug presently whereby if a user has been marked as complete via RPL and the course/activity completion criteria are then unlocked via deletion the completion records associated with the RPL are not correctly cleaned up.
Could this be the situation you find yourself in?

If you have not already filed a help desk issue please do so.

Kind regards
Sam

Wen Hao Chuang
Re: mdl_course_modules_completion vs mdl_course_completions tables
by Wen Hao Chuang - Monday, 26 October 2015, 3:55 PM
 

Hi Sam,

Thanks for helping out! Yes I believe that some (but probably not all) of these users had access to the course in the past.

We also have very limited number of RPL in the past, so I don't think this is the situation that we are in right now.

Any other possible explanation about this?

By the way, can anyone summarize (at high level logic) about how the logic works in the "program (enrollment) plugin" when it comes to the mdl_course_completions, mdl_course_modules, and mdl_course_modules_completion tables? Thanks!

Wen Hao Chuang
Re: mdl_course_modules_completion vs mdl_course_completions tables
by Wen Hao Chuang - Friday, 30 October 2015, 1:35 PM
 

By the way, we ran a query like this:

select cmc.* from mdl_course_modules_completion cmc join mdl_course_modules cm on cmc.coursemoduleid=cm.id where cmc.userid not in (select cc.userid from mdl_course_completions cc where userid=cmc.userid and course=cm.course

And we found that there is a pattern among all the records - a lot of the users has a deleted account. Maybe this is related to what you were talking about, that somehow the mdl_course_modules_completion table was not correctly cleaned up??