MDL-34841 error importing questions with long names.

The problem was with the non-UTF-8-safe way that a question name
was being constructed from the question text.

I have done a proper fix with methods in the base class to
carefully construct a question name that is reasonable, and
which will fit in the database column. Then I have changed all
importers to use the new methods.

I also remembered not to break the lesson in the process.
This commit is contained in:
Tim Hunt
2012-09-12 17:38:40 +01:00
parent 7413ce9896
commit 5df0a6b47e
15 changed files with 154 additions and 59 deletions
+1 -4
View File
@@ -126,10 +126,7 @@ class qformat_learnwise extends qformat_default {
$question = $this->defaultquestion();
$question->qtype = MULTICHOICE;
$question->name = substr($questiontext, 0, 30);
if (strlen($questiontext) > 30) {
$question->name .= '...';
}
$question->name = $this->create_default_question_name($questiontext, get_string('questionname', 'question'));
$question->questiontext = $questiontext;
$question->single = ($type == 'multichoice') ? 1 : 0;