General developer forum

Difference between completion_completion and completion_criteria_completion classes

 
Picture of Kahraman Bulut
Difference between completion_completion and completion_criteria_completion classes
Testers

Hi Dev team,

First of, thank you all for developing the one of the best LMSes, Moodle.


What are the differences and relationships between completion_completion and completion_criteria_completion classes and other subclasses of data_object ?

I am trying to learn and make sense about how course completion works programmatically. 

Thank you!

 
Average of ratings: -
Davo
Re: Difference between completion_completion and completion_criteria_completion classes
Core developersParticularly helpful MoodlersPlugin developers

completion_completion tracks the completion of courses. completion_criteria_completion tracks the completion of individual criteria that contribute to a course being complete. Once all of the completion_criteria_completion are complete for a user on a course, then the completion_completion will be updated to match.

 
Average of ratings: Useful (1)
Picture of Kahraman Bulut
Re: Difference between completion_completion and completion_criteria_completion classes
Testers

Thanks Davo and Matteo, 

That's good. Can you please explain why it is calling the function mark_complete($record->timecompleted); of  the completion_criteria_completion class with the parameter, where completion_criteria_completion class has no parameter in its function 

public function mark_complete()
(line 197 at https://github.com/moodle/moodle/blob/master/completion/criteria/completion_criteria_course.php) :


foreach ($rs as $record) {
$completion = new completion_criteria_completion((array) $record, DATA_OBJECT_FETCH_BY_KEY);
$completion->mark_complete($record->timecompleted);
}

And the mark_complete function of  class completion_completion DO have a parameter
public function mark_complete($timecomplete = null) {

Can you please help me to bring together the pieces of this puzzle?

Thanks!


Best regards,

KB.



 
Average of ratings: -