From 9b5ed22e300fe1ff3c1cfa767bc537523180b26d Mon Sep 17 00:00:00 2001 From: Wiktor Wandachowicz Date: Mon, 5 Aug 2024 12:20:00 +0200 Subject: [PATCH 1/2] MDL-71941 core_grades: use 'gradenoun' core string Replace ('grade','grades') string by core ('gradenoun') string. See: https://tracker.moodle.org/browse/MDL-71941 See: https://github.com/moodle/moodle/commit/1e2300fbd6850fde15ad3f00430f527eb44c5570 --- edit_geogebra_form.php | 2 +- question.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/edit_geogebra_form.php b/edit_geogebra_form.php index 36e3093..3461a50 100644 --- a/edit_geogebra_form.php +++ b/edit_geogebra_form.php @@ -98,7 +98,7 @@ protected function get_per_answer_fields($mform, $label, $gradeoptions, $answeroptions[] = $mform->createElement('text', 'answer', $label, array('size' => 40)); $answeroptions[] = $mform->createElement('select', 'fraction', - get_string('grade', 'grades'), $gradeoptions); + get_string('gradenoun'), $gradeoptions); $repeated[0] = $mform->createElement('group', 'answeroptions', $label, $answeroptions, null, false); $repeated[1] = $mform->createElement('hidden', 'feedback'); diff --git a/question.php b/question.php index e838269..932bef4 100644 --- a/question.php +++ b/question.php @@ -248,10 +248,10 @@ public function summarise_response(array $response) { $summary .= $answer->answer . '='; if ($correct) { $fraction += $answer->fraction; - $summary .= 'true' . ', ' . get_string('grade', 'grades') . ': ' . + $summary .= 'true' . ', ' . get_string('gradenoun') . ': ' . format_float($answer->fraction, 2, false, false); } else { - $summary .= 'false' . ', ' . get_string('grade', 'grades') . ': 0'; + $summary .= 'false' . ', ' . get_string('gradenoun') . ': 0'; } $j++; } From 3b0e52282f1ec24069e674ba94e4876408eb9b82 Mon Sep 17 00:00:00 2001 From: Wiktor Wandachowicz Date: Mon, 2 Sep 2024 15:00:11 +0200 Subject: [PATCH 2/2] MDL-71941 core_grades: use 'gradenoun' core string with backwards compatibility Replace ('grade','grades') string by core ('gradenoun') string. See: https://tracker.moodle.org/browse/MDL-71941 See: https://github.com/moodle/moodle/commit/1e2300fbd6850fde15ad3f00430f527eb44c5570 --- edit_geogebra_form.php | 10 +++++++++- question.php | 12 ++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/edit_geogebra_form.php b/edit_geogebra_form.php index 3461a50..d470eb5 100644 --- a/edit_geogebra_form.php +++ b/edit_geogebra_form.php @@ -92,13 +92,21 @@ public function __construct($submiturl, $question, $category, $contexts, $formed */ protected function get_per_answer_fields($mform, $label, $gradeoptions, &$repeatedoptions, &$answersoption) { + global $CFG; + if ((int)$CFG->branch < 311) { + // Pre-3.11 string. + $gradestr = get_string('grade', 'grades'); + } else { + // New string for "Grade", see MDL-71941. + $gradestr = get_string('gradenoun'); + } $repeated = array(); $answeroptions = array(); $answeroptions[] = $mform->createElement('text', 'answer', $label, array('size' => 40)); $answeroptions[] = $mform->createElement('select', 'fraction', - get_string('gradenoun'), $gradeoptions); + $gradestr, $gradeoptions); $repeated[0] = $mform->createElement('group', 'answeroptions', $label, $answeroptions, null, false); $repeated[1] = $mform->createElement('hidden', 'feedback'); diff --git a/question.php b/question.php index 932bef4..e9b59cf 100644 --- a/question.php +++ b/question.php @@ -229,9 +229,17 @@ public function is_gradable_response(array $response) { * @return string a plain text summary of that response, that could be used in reports. */ public function summarise_response(array $response) { + global $CFG; if (empty($this->answers) && !$this->isexercise) { return "Response graded manually"; } else { + if ((int)$CFG->branch < 311) { + // Pre-3.11 string. + $gradestr = get_string('grade', 'grades'); + } else { + // New string for "Grade", see MDL-71941. + $gradestr = get_string('gradenoun'); + } $resp = $response['answer']; if ($resp === '' && !$this->isexercise) { return get_string('noresponse', 'question'); @@ -248,10 +256,10 @@ public function summarise_response(array $response) { $summary .= $answer->answer . '='; if ($correct) { $fraction += $answer->fraction; - $summary .= 'true' . ', ' . get_string('gradenoun') . ': ' . + $summary .= 'true' . ', ' . $gradestr . ': ' . format_float($answer->fraction, 2, false, false); } else { - $summary .= 'false' . ', ' . get_string('gradenoun') . ': 0'; + $summary .= 'false' . ', ' . $gradestr . ': 0'; } $j++; }