mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
lesson grading: MDL-17101 The lesson module was sending the incorrect raw grade values. Correcting the values by calculating the actual raw grade before sending to gradebook. Merged from MOODLE_19_STABLE and updated for trunk.
This commit is contained in:
parent
5e4d8cb404
commit
13b92708d2
@ -44,7 +44,17 @@ function xmldb_lesson_upgrade($oldversion) {
|
||||
|
||||
upgrade_mod_savepoint($result, 2007072201, 'lesson');
|
||||
}
|
||||
|
||||
|
||||
if ($result && $oldversion < 2008112601) {
|
||||
require_once($CFG->dirroot.'/mod/lesson/lib.php');
|
||||
// too much debug output
|
||||
$DB->set_debug(false);
|
||||
lesson_update_grades();
|
||||
$DB->set_debug(true);
|
||||
|
||||
upgrade_mod_savepoint($result, 2008112601, 'lesson');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -459,6 +459,19 @@ function lesson_grade_item_update($lesson, $grades=NULL) {
|
||||
if ($grades === 'reset') {
|
||||
$params['reset'] = true;
|
||||
$grades = NULL;
|
||||
} else if (!empty($grades)) {
|
||||
// Need to calculate raw grade (Note: $grades has many forms)
|
||||
if (is_object($grades)) {
|
||||
$grades = array($grades->userid => $grades);
|
||||
} else if (array_key_exists('userid', $grades)) {
|
||||
$grades = array($grades['userid'] => $grades);
|
||||
}
|
||||
foreach ($grades as $key => $grade) {
|
||||
if (!is_array($grade)) {
|
||||
$grades[$key] = $grade = (array) $grade;
|
||||
}
|
||||
$grades[$key]['rawgrade'] = ($grade['rawgrade'] * $lesson->grade / 100);
|
||||
}
|
||||
}
|
||||
|
||||
return grade_update('mod/lesson', $lesson->course, 'mod', 'lesson', $lesson->id, 0, $grades, $params);
|
||||
|
@ -8,7 +8,7 @@
|
||||
* @package lesson
|
||||
**/
|
||||
|
||||
$module->version = 2008112600; // The current module version (Date: YYYYMMDDXX)
|
||||
$module->version = 2008112601; // The current module version (Date: YYYYMMDDXX)
|
||||
$module->requires = 2008072401; // Requires this Moodle version
|
||||
$module->cron = 0; // Period for cron to check this module (secs)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user