Skip to content

Commit

Permalink
Merge pull request #83 from wiktorwandachowicz/MDL-71941
Browse files Browse the repository at this point in the history
MDL-71941 core_grades: use 'gradenoun' core string
  • Loading branch information
PhMemmel authored Sep 26, 2024
2 parents f62d8bd + 3b0e522 commit aa834ce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
10 changes: 9 additions & 1 deletion edit_geogebra_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('grade', 'grades'), $gradeoptions);
$gradestr, $gradeoptions);
$repeated[0] = $mform->createElement('group', 'answeroptions',
$label, $answeroptions, null, false);
$repeated[1] = $mform->createElement('hidden', 'feedback');
Expand Down
12 changes: 10 additions & 2 deletions question.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -248,10 +256,10 @@ public function summarise_response(array $response) {
$summary .= $answer->answer . '=';
if ($correct) {
$fraction += $answer->fraction;
$summary .= 'true' . ', ' . get_string('grade', 'grades') . ': ' .
$summary .= 'true' . ', ' . $gradestr . ': ' .
format_float($answer->fraction, 2, false, false);
} else {
$summary .= 'false' . ', ' . get_string('grade', 'grades') . ': 0';
$summary .= 'false' . ', ' . $gradestr . ': 0';
}
$j++;
}
Expand Down

0 comments on commit aa834ce

Please sign in to comment.