MDL-80766 gradereport_grader: omit max constraint for unlimited grades.

This commit is contained in:
Paul Holden 2024-01-30 21:09:57 +00:00
parent f30110b5eb
commit 717a616030
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164
3 changed files with 9 additions and 2 deletions

View File

@ -1096,7 +1096,9 @@ class grade_report_grader extends grade_report {
// If we're rendering this as a number field, set min/max attributes, if applicable.
if ($context->isnumeric) {
$context->minvalue = $item->grademin ?? null;
$context->maxvalue = $item->grademax ?? null;
if (empty($CFG->unlimitedgrades)) {
$context->maxvalue = $item->grademax ?? null;
}
}
$value = format_float($gradeval, $decimalpoints);

View File

@ -113,6 +113,8 @@ class finalgrade extends grade_attribute_format implements unique_value, be_disa
* @return element
*/
public function determine_format(): element {
global $CFG;
if ($this->grade->grade_item->load_scale()) {
$scale = $this->grade->grade_item->load_scale();
@ -153,7 +155,7 @@ class finalgrade extends grade_attribute_format implements unique_value, be_disa
// Max attribute.
$maxvalue = null;
if (isset($gradeitem->grademax)) {
if (isset($gradeitem->grademax) && empty($CFG->unlimitedgrades)) {
$maxvalue = format_float($gradeitem->grademax, $decimals);
}
$textattribute->set_max($maxvalue);

View File

@ -27,6 +27,9 @@
"extraclasses": "statusicons",
"value": "Text information",
"tabindex": "1",
"isnumeric": "1",
"minvalue": "0",
"maxvalue": "10",
"name": "grade[313][624]"
}
}}