Permalink
Browse files

MDL-37599 question import: add missing string.

AMOS BEGIN
 MOV [matcherror,question],[invalidgrade,question]
AMOS END
  • Loading branch information...
1 parent 7def533 commit 9970d909a3affb38e763316fb5608953ada76091 @timhunt timhunt committed Jan 21, 2013
Showing with 6 additions and 5 deletions.
  1. +1 −1 lang/en/question.php
  2. +5 −4 question/format.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';
View
@@ -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 {

0 comments on commit 9970d90

Please sign in to comment.