Skip to content

Commit

Permalink
Fixed issue #7703: results not saved when rel eq contains errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mfaber committed Mar 12, 2014
1 parent 1001b3e commit 959a660
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -4402,10 +4402,18 @@ private function _ProcessSubQRelevance($eqn,$questionNum=NULL,$rowdivid=NULL, $t
}

if (!is_null($questionNum)) {
// make sure subquestions with errors in relevance equations are always shown and answers recorded #7703
if ($hasErrors)
{
$result=true;
$relevanceJS=1;
}
else
{
$relevanceJS = $this->em->GetJavaScriptEquivalentOfExpression();
}
$jsVars = $this->em->GetJSVarsUsed();
$relevanceVars = implode('|',$this->em->GetJSVarsUsed());
$relevanceJS = $this->em->GetJavaScriptEquivalentOfExpression();

$isExclusiveJS='';
$irrelevantAndExclusiveJS='';
// Only need to extract JS, since will already have Vars and error counts from main equation
Expand Down Expand Up @@ -4943,7 +4951,6 @@ static function NavigateForwards($force=false) {
$LEM->StartProcessingPage(true);
$updatedValues=$LEM->ProcessCurrentResponses();
$message = '';

$LEM->currentQset = array(); // reset active list of questions
$result = $LEM->_ValidateSurvey();
$message .= $result['message'];
Expand Down Expand Up @@ -6002,6 +6009,11 @@ function _ValidateQuestion($questionSeq)
$stringToParse = htmlspecialchars_decode($sq['eqn'],ENT_QUOTES); // TODO is this needed?
$sqrel = $LEM->em->ProcessBooleanExpression($stringToParse,$qInfo['gseq'], $qInfo['qseq']);
$hasErrors = $LEM->em->HasErrors();
// make sure subquestions with errors in relevance equations are always shown and answers recorded #7703
if ($hasErrors)
{
$sqrel=true;
}
if (($LEM->debugLevel & LEM_PRETTY_PRINT_ALL_SYNTAX) == LEM_PRETTY_PRINT_ALL_SYNTAX)
{
$prettyPrintSQRelEqn = $LEM->em->GetPrettyPrintString();
Expand Down Expand Up @@ -6043,6 +6055,11 @@ function _ValidateQuestion($questionSeq)
$stringToParse = htmlspecialchars_decode($sq['eqn'],ENT_QUOTES); // TODO is this needed?
$sqrel = $LEM->em->ProcessBooleanExpression($stringToParse,$qInfo['gseq'], $qInfo['qseq']);
$hasErrors = $LEM->em->HasErrors();
// make sure subquestions with errors in relevance equations are always shown and answers recorded #7703
if ($hasErrors)
{
$sqrel=true;
}
if (($LEM->debugLevel & LEM_PRETTY_PRINT_ALL_SYNTAX) == LEM_PRETTY_PRINT_ALL_SYNTAX)
{
$prettyPrintSQRelEqn = $LEM->em->GetPrettyPrintString();
Expand Down Expand Up @@ -6091,6 +6108,11 @@ function _ValidateQuestion($questionSeq)
$stringToParse = htmlspecialchars_decode($sq['eqn'],ENT_QUOTES); // TODO is this needed?
$sqrel = $LEM->em->ProcessBooleanExpression($stringToParse,$qInfo['gseq'], $qInfo['qseq']);
$hasErrors = $LEM->em->HasErrors();
// make sure subquestions with errors in relevance equations are always shown and answers recorded #7703
if ($hasErrors)
{
$sqrel=true;
}
if (($LEM->debugLevel & LEM_PRETTY_PRINT_ALL_SYNTAX) == LEM_PRETTY_PRINT_ALL_SYNTAX)
{
$prettyPrintSQRelEqn = $LEM->em->GetPrettyPrintString();
Expand Down Expand Up @@ -6131,6 +6153,11 @@ function _ValidateQuestion($questionSeq)
$stringToParse = htmlspecialchars_decode($sq['eqn'],ENT_QUOTES); // TODO is this needed?
$sqrel = $LEM->em->ProcessBooleanExpression($stringToParse,$qInfo['gseq'], $qInfo['qseq']);
$hasErrors = $LEM->em->HasErrors();
// make sure subquestions with errors in relevance equations are always shown and answers recorded #7703
if ($hasErrors)
{
$sqrel=true;
}
if (($LEM->debugLevel & LEM_PRETTY_PRINT_ALL_SYNTAX) == LEM_PRETTY_PRINT_ALL_SYNTAX)
{
$prettyPrintSQRelEqn = $LEM->em->GetPrettyPrintString();
Expand Down Expand Up @@ -6970,7 +6997,8 @@ static function GetRelevanceAndTailoringJavaScript()
}
}
// end
$relParts[] = " if ( " . $sq['relevancejs'] . " ) {\n";
//this change is optional....changes to array should prevent "if( )"
$relParts[] = " if ( " . (empty($sq['relevancejs'])?'1':$sq['relevancejs']) . " ) {\n";
if ($afHide)
{
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').show();\n";
Expand Down

0 comments on commit 959a660

Please sign in to comment.