MDL-80984 mod_assign: penalty implementation

This commit is contained in:
Nathan Nguyen
2025-03-19 23:00:52 +08:00
committed by Andrew Nicols
parent cfc6db3866
commit cd239dd1c3
33 changed files with 1276 additions and 26 deletions
+4 -3
View File
@@ -753,9 +753,10 @@ class assign_grading_table extends table_sql implements renderable {
* @param boolean $editable
* @param int $userid The user id of the user this grade belongs to
* @param int $modified Timestamp showing when the grade was last modified
* @param float $deductedmark The deducted mark if penalty is applied
* @return string The formatted grade
*/
public function display_grade($grade, $editable, $userid, $modified) {
public function display_grade($grade, $editable, $userid, $modified, float $deductedmark = 0) {
if ($this->is_downloading()) {
if ($this->assignment->get_instance()->grade >= 0) {
if ($grade == -1 || $grade === null) {
@@ -772,7 +773,7 @@ class assign_grading_table extends table_sql implements renderable {
return $scale;
}
}
return $this->assignment->display_grade($grade, $editable, $userid, $modified);
return $this->assignment->display_grade($grade, $editable, $userid, $modified, $deductedmark);
}
/**
@@ -1035,7 +1036,7 @@ class assign_grading_table extends table_sql implements renderable {
$grade = $this->get_gradebook_data_for_user($row->userid);
if ($grade) {
$o = $this->display_grade($grade->grade, false, $row->userid, $row->timemarked);
$o = $this->display_grade($grade->grade, false, $row->userid, $row->timemarked, $grade->deductedmark);
}
return $o;