Skip to content

Commit

Permalink
Fixed issue #13185: Rendering issue when adding new questions (Preview)
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Feb 2, 2018
1 parent b132eac commit 646b42e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
8 changes: 7 additions & 1 deletion application/controllers/admin/database.php
Expand Up @@ -1443,6 +1443,12 @@ private function _resetEM(){
$oEM =& LimeExpressionManager::singleton();
LimeExpressionManager::UpgradeConditionsToRelevance($this->iSurveyID);
LimeExpressionManager::StartSurvey($oSurvey->sid,'survey',$oSurvey->attributes,true);

LimeExpressionManager::StartProcessingPage(true,true);
$aGrouplist = QuestionGroup::model()->getGroups($this->iSurveyID);
foreach ($aGrouplist as $iGID => $aGroup) {
LimeExpressionManager::StartProcessingGroup($aGroup['gid'], $oSurvey->anonymized != 'Y', $this->iSurveyID);
LimeExpressionManager::FinishProcessingGroup();
}
LimeExpressionManager::FinishProcessingPage();
}
}
10 changes: 5 additions & 5 deletions application/controllers/survey/index.php
Expand Up @@ -570,7 +570,7 @@ public function action()
}

// Preview action : Preview right already tested before
if ($previewmode === true) {
if ($previewmode == 'previewgroup' || $previewmode == 'previewquestion') {

// Unset all SESSION: be sure to have the last version
unset($_SESSION['fieldmap-'.$surveyid.App()->language]); // Needed by createFieldMap: else fieldmap can be outdated
Expand All @@ -594,11 +594,11 @@ public function action()
$redata = compact(array_keys(get_defined_vars()));
Yii::import('application.helpers.SurveyRuntimeHelper');
$tmp = new SurveyRuntimeHelper();
try {
// try {
$tmp->run($surveyid, $redata);
} catch (WrongTemplateVersionException $ex) {
echo $ex->getMessage();
}
// } catch (WrongTemplateVersionException $ex) {
// echo $ex->getMessage();
// }

if (App()->request->getPost('saveall')) {
App()->clientScript->registerScript("saveflashmessage", "alert('".gT("Your responses were successfully saved.", "js")."');", CClientScript::POS_READY);
Expand Down
3 changes: 2 additions & 1 deletion application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -112,6 +112,7 @@ public function run($surveyid, $args)
$this->setNotAnsweredAndNotValidated();

} else {
$this->initMove(); // main methods to init session, LEM, moves, errors, etc
$this->setPreview();
}

Expand Down Expand Up @@ -668,7 +669,7 @@ private function initFirstStep()
{

// First time the survey is loaded
if (!isset($_SESSION[$this->LEMsessid]['step'])) {
if (!isset($_SESSION[$this->LEMsessid]['step']) || ($this->previewquestion || $this->previewgrp) ) {
// Init session, randomization and filed array
buildsurveysession($this->iSurveyid);
$fieldmap = randomizationGroupsAndQuestions($this->iSurveyid);
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/expressions/em_core_helper.php
Expand Up @@ -406,7 +406,7 @@ public function RDP_EvaluateBinary(array $token)
break;
case '*':
if ($bBothNumeric) {
$result = array(($arg1[0] * $arg2[0]), $token[1], 'NUMBER');
$result = array((doubleVal($arg1[0]) * doubleVal($arg2[0])), $token[1], 'NUMBER');
} else {
$result = array(NAN, $token[1], 'NUMBER');
}
Expand Down

0 comments on commit 646b42e

Please sign in to comment.