Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-32386 completion: Fix incorrect method parameters

  • Loading branch information...
commit aac67f6384a11c839801231da305ae26f7a6cf92 1 parent bac15e5
@srynot4sale srynot4sale authored
Showing with 6 additions and 2 deletions.
  1. +5 −1 lib/completionlib.php
  2. +1 −1  lib/tests/completionlib_test.php
View
6 lib/completionlib.php
@@ -621,16 +621,20 @@ public function set_module_viewed($cm, $userid=0) {
debugging('set_module_viewed must be called before header is printed',
DEBUG_DEVELOPER);
}
+
// Don't do anything if view condition is not turned on
if ($cm->completionview == COMPLETION_VIEW_NOT_REQUIRED || !$this->is_enabled($cm)) {
return;
}
+
// Get current completion state
- $data = $this->get_data($cm, $userid);
+ $data = $this->get_data($cm, false, $userid);
+
// If we already viewed it, don't do anything
if ($data->viewed == COMPLETION_VIEWED) {
return;
}
+
// OK, change state, save it, and update completion
$data->viewed = COMPLETION_VIEWED;
$this->internal_set_data($cm, $data);
View
2  lib/tests/completionlib_test.php
@@ -257,7 +257,7 @@ function test_set_module_viewed() {
->will($this->returnValue(true));
$c->expects($this->at(1))
->method('get_data')
- ->with($cm, 1337)
+ ->with($cm, false, 1337)
->will($this->returnValue((object)array('viewed'=>COMPLETION_NOT_VIEWED)));
$c->expects($this->at(2))
->method('internal_set_data')
Please sign in to comment.
Something went wrong with that request. Please try again.