Skip to content

Commit

Permalink
MDL-15113 Upgrade to DMLLIB 2.0. Needs further testing and bug-fixing.
Browse files Browse the repository at this point in the history
MDL-15100 Fixed a bug in gradelib.php
Plus edited tablelib.php for table_sql upgrade to dmllib 2.0
  • Loading branch information
nicolasconnault committed Jun 9, 2008
1 parent 1d295d6 commit 9cf4a18
Show file tree
Hide file tree
Showing 25 changed files with 708 additions and 608 deletions.
10 changes: 4 additions & 6 deletions lib/gradelib.php
Expand Up @@ -209,7 +209,7 @@ function grade_update($source, $courseid, $itemtype, $itemmodule, $iteminstance,

$count = count($grades);
if ($count > 0 and $count < 200) {
list($uids, $params) = $DB->get_in_or_equal(array_keys($grades), SQL_PARAMS_NAMED, $start='uid0');
list($uids, $params) = $DB->get_in_or_equal(array_keys($grades), SQL_PARAMS_NAMED, $start='uid0');
$params['gid'] = $grade_item->id;
$sql = "SELECT * FROM {grade_grades} WHERE itemid = :gid AND userid $uids";

Expand All @@ -226,11 +226,8 @@ function grade_update($source, $courseid, $itemtype, $itemmodule, $iteminstance,
$grade_grade = null;
$grade = null;

while ($rs and $rs->valid()) {
$rs->next();
if (!$gd = $rs->current()) {
break;
}
foreach ($rs as $gd) {

$userid = $gd->userid;
if (!isset($grades[$userid])) {
// this grade not requested, continue
Expand All @@ -243,6 +240,7 @@ function grade_update($source, $courseid, $itemtype, $itemmodule, $iteminstance,
break;
}


if (is_null($grade_grade)) {
if (count($grades) == 0) {
// no more grades to process
Expand Down

0 comments on commit 9cf4a18

Please sign in to comment.