MDL-73003 core_grades: Don't use 'scale' to determine grading method.

When a forum activity used a rubrics with a scale for grading, it was not treated as an advanced grading method, causing
the code to mishandle the grading object and not return any grades.
This commit is contained in:
Jayce Birrell
2025-06-18 16:51:20 +09:30
parent 95518023c6
commit 693d89cbdb
2 changed files with 43 additions and 13 deletions
+1 -9
View File
@@ -204,15 +204,7 @@ abstract class component_gradeitem {
* @return bool
*/
public function is_using_advanced_grading(): bool {
if ($this->is_using_scale()) {
return false;
}
if ($this->get_advanced_grading_controller()) {
return true;
}
return false;
return (bool) $this->get_advanced_grading_controller();
}
/**
@@ -4,7 +4,7 @@ Feature: Converting rubric score to grades
As a teacher
I need to be able to use different grade settings
Scenario Outline: Convert rubric scores to grades.
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
@@ -19,9 +19,11 @@ Feature: Converting rubric score to grades
And the following "scales" exist:
| name | scale |
| Test scale 1 | Disappointing, Good, Very good, Excellent |
And the following "activities" exist:
| activity | name | intro | course | idnumber | grade | advancedgradingmethod_submissions |
| assign | Test assignment 1 | Test | C1 | assign1 | <grade> | rubric |
Scenario Outline: Convert assignment rubric scores to grades.
Given the following "activities" exist:
| activity | name | intro | course | idnumber | grade | advancedgradingmethod_submissions |
| assign | Test assignment 1 | Test | C1 | assign1 | <grade> | rubric |
When I log in as "teacher1"
And I change window size to "large"
And I am on "Course 1" course homepage with editing mode on
@@ -55,3 +57,39 @@ Feature: Converting rubric score to grades
| 100 | | 10.00 |
| 70 | | 7.00 |
| Test scale 1 | | Disappointing |
Scenario Outline: Convert forum rubric scores with a scale to grades.
Given the following "activities" exist:
| activity | name | intro | course | idnumber | grade | advancedgradingmethod_submissions |
| forum | Test forum 1 | Test | C1 | forum1 | 100 | rubric |
And I change window size to "large"
And I am on the "Test forum 1" "forum activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the following fields to these values:
| Whole forum grading > Type | Scale |
| Whole forum grading > Scale | Default competence scale |
| Grading method | Rubric |
And I press "Save and display"
And I go to "Test forum 1" advanced grading definition page
# Defining a rubric.
And I set the following fields to these values:
| Name | Forum 1 rubric |
| Description | Rubric test description |
And I define the following rubric:
| Criterion 1 | Level 11 | 1 | Level 12 | 20 | Level 13 | 40 | Level 14 | 50 |
| Criterion 2 | Level 21 | 10 | Level 22 | 20 | Level 23 | 30 | | |
| Criterion 3 | Level 31 | 5 | Level 32 | 20 | | | | |
And I press "Save rubric and make it ready"
When I am on the "Test forum 1" "forum activity" page logged in as teacher1
And I press "Grade users"
And I click on "<criterion1> points" "radio"
And I click on "<criterion2> points" "radio"
And I click on "<criterion3> points" "radio"
And I press "Save"
And I am on the "Course 1" "grades > Grader report > View" page
Then I should see "<studentgrade>" in the "student1@example.com" "table_row"
Examples:
| studentgrade | criterion1 | criterion2 | criterion3 |
| Competent | Level 14 50 | Level 23 30 | Level 32 20 |
| Not yet competent | Level 11 1 | Level 21 10 | Level 31 5 |