Skip to content

Commit

Permalink
Fix multiplication question order see BT#16850
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Apr 30, 2020
1 parent 972b3ff commit b71296f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion main/survey/survey.lib.php
Expand Up @@ -2302,15 +2302,26 @@ public static function multiplicateQuestions($surveyData)

public static function parseMultiplicateUserList($itemList, $questions, $courseId, $surveyData)
{
if (empty($itemList) || empty($questions)) {
return false;
}

$surveyId = $surveyData['survey_id'];
$classTag = '{{class_name}}';
$studentTag = '{{student_full_name}}';
$classCounter = 0;

$newQuestionList = [];
foreach ($questions as $question) {
$newQuestionList[$question['sort']] = $question;
}
ksort($newQuestionList);

foreach ($itemList as $class) {
$className = $class['name'];
$users = $class['users'];

foreach ($questions as $question) {
foreach ($newQuestionList as $question) {
$text = $question['question'];
if (strpos($text, $classTag) !== false) {
$replacedText = str_replace($classTag, $className, $text);
Expand Down Expand Up @@ -2373,6 +2384,8 @@ public static function parseMultiplicateUserList($itemList, $questions, $courseI
}
}
}

return true;
}

/**
Expand Down

0 comments on commit b71296f

Please sign in to comment.