Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDL-71941 core_grades: use 'gradenoun' core string #83

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading