|
@ -1236,23 +1236,13 @@ class attendance { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function update_users_grade($userids) { |
|
|
public function update_users_grade($userids) { |
|
|
global $DB; |
|
|
|
|
|
$grades = array(); |
|
|
$grades = array(); |
|
|
|
|
|
|
|
|
if ($this->grade < 0) { |
|
|
|
|
|
$dbparams = array('id' => -($this->grade)); |
|
|
|
|
|
$this->scale = $DB->get_record('scale', $dbparams); |
|
|
|
|
|
$scalearray = explode(',', $this->scale->scale); |
|
|
|
|
|
$attendancegrade = count($scalearray); |
|
|
|
|
|
} else { |
|
|
|
|
|
$attendancegrade = $this->grade; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
foreach ($userids as $userid) { |
|
|
foreach ($userids as $userid) { |
|
|
$grades[$userid] = new stdClass(); |
|
|
$grades[$userid] = new stdClass(); |
|
|
$grades[$userid]->userid = $userid; |
|
|
$grades[$userid]->userid = $userid; |
|
|
$grades[$userid]->rawgrade = att_calc_user_grade_fraction($this->get_user_grade($userid), |
|
|
$grades[$userid]->rawgrade = att_calc_user_grade_fraction($this->get_user_grade($userid), |
|
|
$this->get_user_max_grade($userid)) * $attendancegrade; |
|
|
$this->get_user_max_grade($userid)) * $this->grade; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return grade_update('mod/attendance', $this->course->id, 'mod', 'attendance', |
|
|
return grade_update('mod/attendance', $this->course->id, 'mod', 'attendance', |
|
@ -1719,14 +1709,7 @@ function att_update_all_users_grades($attid, $course, $context, $coursemodule) { |
|
|
$userids = array_keys(get_enrolled_users($context, 'mod/attendance:canbelisted', 0, 'u.id')); |
|
|
$userids = array_keys(get_enrolled_users($context, 'mod/attendance:canbelisted', 0, 'u.id')); |
|
|
|
|
|
|
|
|
$statuses = att_get_statuses($attid); |
|
|
$statuses = att_get_statuses($attid); |
|
|
if ($this->grade < 0) { |
|
|
$gradebookmaxgrade = att_get_gradebook_maxgrade($attid); |
|
|
$dbparams = array('id' => -($this->grade)); |
|
|
|
|
|
$this->scale = $DB->get_record('scale', $dbparams); |
|
|
|
|
|
$scalearray = explode(',', $this->scale->scale); |
|
|
|
|
|
$gradebookmaxgrade = count($scalearray); |
|
|
|
|
|
} else { |
|
|
|
|
|
$gradebookmaxgrade = att_get_gradebook_maxgrade($attid); |
|
|
|
|
|
} |
|
|
|
|
|
foreach ($userids as $userid) { |
|
|
foreach ($userids as $userid) { |
|
|
$grade = new stdClass; |
|
|
$grade = new stdClass; |
|
|
$grade->userid = $userid; |
|
|
$grade->userid = $userid; |
|
|