My Moodle/Courses: MDL-20472 get_my_courses returns 2 more courses then limit. Repairs two off by one errors in get_my_courses and get_user_courses_bycap.

This commit is contained in:
ericmerrill
2009-10-08 04:52:33 +00:00
parent 453bf70f6e
commit 4a09658ea8
2 changed files with 8 additions and 4 deletions
+4 -2
View File
@@ -926,10 +926,12 @@ function get_my_courses($userid, $sort='visible DESC,sortorder ASC', $fields=NUL
// build the context obj
$c = make_context_subobj($c);
$courses[$c->id] = $c;
if ($limit > 0 && $cc++ > $limit) {
if ($limit > 0 && $cc >= $limit) {
break;
}
$courses[$c->id] = $c;
$cc++;
}
$rs->close();
return $courses;