From 9970d909a3affb38e763316fb5608953ada76091 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Mon, 21 Jan 2013 12:07:47 +0000 Subject: [PATCH] MDL-37599 question import: add missing string. AMOS BEGIN MOV [matcherror,question],[invalidgrade,question] AMOS END --- lang/en/question.php | 2 +- question/format.php | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lang/en/question.php b/lang/en/question.php index 56d1a07728eea..c029060612907 100644 --- a/lang/en/question.php +++ b/lang/en/question.php @@ -183,13 +183,13 @@ $string['invalidcategoryidtomove'] = 'Invalid category id to move!'; $string['invalidconfirm'] = 'Confirmation string was incorrect'; $string['invalidcontextinhasanyquestions'] = 'Invalid context passed to question_context_has_any_questions.'; +$string['invalidgrade'] = 'Grades ({$a}) do not match grade options - question skipped.'; $string['invalidpenalty'] = 'Invalid penalty'; $string['invalidwizardpage'] = 'Incorrect or no wizard page specified!'; $string['lastmodifiedby'] = 'Last modified by'; $string['linkedfiledoesntexist'] = 'Linked file {$a} doesn\'t exist'; $string['makechildof'] = 'Make child of \'{$a}\''; $string['maketoplevelitem'] = 'Move to top level'; -$string['matcherror'] = 'Grades do not match grade options - question skipped'; $string['matchgrades'] = 'Match grades'; $string['matchgradeserror'] = 'Error if grade not listed'; $string['matchgradesnearest'] = 'Nearest grade if not listed'; diff --git a/question/format.php b/question/format.php index 7abdbcb2ae80d..c4ff0de1a8d4a 100644 --- a/question/format.php +++ b/question/format.php @@ -325,18 +325,19 @@ public function importprocess($category) { foreach ($questions as $question) { if (!empty($question->fraction) and (is_array($question->fraction))) { $fractions = $question->fraction; - $answersvalid = true; // in case they are! + $invalidfractions = array(); foreach ($fractions as $key => $fraction) { $newfraction = match_grade_options($gradeoptionsfull, $fraction, $this->matchgrades); if ($newfraction === false) { - $answersvalid = false; + $invalidfractions[] = $fraction; } else { $fractions[$key] = $newfraction; } } - if (!$answersvalid) { - echo $OUTPUT->notification(get_string('invalidgrade', 'question')); + if ($invalidfractions) { + echo $OUTPUT->notification(get_string('invalidgrade', 'question', + implode(', ', $invalidfractions))); ++$gradeerrors; continue; } else {