MDL-48715 mod_lesson: completion rules must not be dependent

This commit is contained in:
Jean-Michel Vedrine
2015-03-19 12:24:55 +01:00
committed by Eloy Lafuente (stronk7)
parent 2e796a1615
commit 4b570f7144
3 changed files with 11 additions and 2 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ $string['completederror'] = 'Complete the lesson';
$string['completethefollowingconditions'] = 'You must complete the following condition(s) in <b>{$a}</b> lesson before you can proceed.';
$string['completionendreached'] = 'Require end reached';
$string['completionendreached_desc'] = 'Student must reach the end of lesson page to complete this activity';
$string['completiontimespent'] = 'Student must do this activity for';
$string['completiontimespent'] = 'Student must do this activity at least for';
$string['completiontimespentgroup'] = 'Require time spent';
$string['conditionsfordependency'] = 'Condition(s) for the dependency';
$string['configactionaftercorrectanswer'] = 'The default action to take after a correct answer';
+9
View File
@@ -1278,6 +1278,15 @@ class lesson extends lesson_base {
$timer->lessontime = time();
$timer->completed = $endreached;
$DB->update_record('lesson_timer', $timer);
// Update completion state.
$cm = get_coursemodule_from_instance('lesson', $this->properties()->id, $this->properties()->course,
false, MUST_EXIST);
$course = get_course($cm->course);
$completion = new completion_info($course);
if ($completion->is_enabled($cm) && $this->properties()->completiontimespent > 0) {
$completion->update_state($cm, COMPLETION_COMPLETE);
}
return $timer;
}
+1 -1
View File
@@ -458,7 +458,7 @@ if ($pageid != LESSON_EOL) {
// Update completion state.
$completion = new completion_info($course);
if ($completion->is_enabled($cm) && ($lesson->completionendreached || $lesson->completiontimespent > 0)) {
if ($completion->is_enabled($cm) && $lesson->completionendreached) {
$completion->update_state($cm, COMPLETION_COMPLETE);
}