MDL-60950 assign: Robust filtering of grading table
authorDamyon Wiese <damyon@moodle.com>
Wed, 13 Jun 2018 03:19:37 +0000 (11:19 +0800)
committerDamyon Wiese <damyon@moodle.com>
Tue, 19 Jun 2018 02:09:42 +0000 (10:09 +0800)
For assignments with gradetype set to none, we need special handling when generating the query to filter submissions that need grading.

mod/assign/gradingtable.php

index ad5ba63..071f6e9 100644 (file)
@@ -277,7 +277,8 @@ class assign_grading_table extends table_sql implements renderable {
                                  s.status = :submitted AND
                                  (s.timemodified >= g.timemodified OR g.timemodified IS NULL OR g.grade IS NULL';
 
-                if ($this->assignment->get_grade_item()->gradetype == GRADE_TYPE_SCALE) {
+                // Assignment grade is set to the negative grade scale id when scales are used.
+                if ($this->assignment->get_instance()->grade < 0) {
                     // Scale grades are set to -1 when not graded.
                     $where .= ' OR g.grade = -1';
                 }