mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Small bug fixed where last question of a file wasn't detected if it
wasn't followed by a blank line
This commit is contained in:
parent
7aab220e4b
commit
f5fb84cee7
@ -91,17 +91,23 @@ class quiz_default_format {
|
||||
$currentquestion = array();
|
||||
|
||||
foreach ($lines as $line) {
|
||||
$line = trim($line);
|
||||
if (empty($line)) {
|
||||
if (!empty($currentquestion)) {
|
||||
if ($question = $this->readquestion($currentquestion)) {
|
||||
$questions[] = $question;
|
||||
}
|
||||
$currentquestion = array();
|
||||
}
|
||||
} else {
|
||||
$currentquestion[] = $line;
|
||||
}
|
||||
$line = trim($line);
|
||||
if (empty($line)) {
|
||||
if (!empty($currentquestion)) {
|
||||
if ($question = $this->readquestion($currentquestion)) {
|
||||
$questions[] = $question;
|
||||
}
|
||||
$currentquestion = array();
|
||||
}
|
||||
} else {
|
||||
$currentquestion[] = $line;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($currentquestion)) { // There may be a final question
|
||||
if ($question = $this->readquestion($currentquestion)) {
|
||||
$questions[] = $question;
|
||||
}
|
||||
}
|
||||
|
||||
return $questions;
|
||||
|
Loading…
x
Reference in New Issue
Block a user