Skip to content

Commit

Permalink
Dev: Remove unused variables in EM
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Dec 21, 2016
1 parent 36a4b45 commit 04884e9
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -6129,6 +6129,7 @@ function _ValidateQuestion($questionSeq,$force=false)
$prettyPrintSQRelEqn='';
$prettyPrintValidTip='';
$anyUnanswered = false;
$sgqas = array();

if (!$qrel)
{
Expand Down Expand Up @@ -7360,7 +7361,7 @@ static function GetRelevanceAndTailoringJavaScript()
if ($_veq['subqValidSelector'] == '') {
continue;
}
$isValid = $LEM->em->ProcessBooleanExpression($_veq['subqValidEqn'],$arg['gseq'],$LEM->questionId2questionSeq[$arg['qid']]);
$LEM->em->ProcessBooleanExpression($_veq['subqValidEqn'],$arg['gseq'],$LEM->questionId2questionSeq[$arg['qid']]);
$_sqValidVars = $LEM->em->GetJSVarsUsed();
$allJsVarsUsed = array_merge($allJsVarsUsed,$_sqValidVars);
$valJsVarsUsed = array_merge($valJsVarsUsed,$_sqValidVars);
Expand All @@ -7377,9 +7378,6 @@ static function GetRelevanceAndTailoringJavaScript()

// Set color-coding for validation equations
if (count($validationEqns) > 0) {
$_hasSumRange=false;
$_hasOtherValidation=false;
$_hasOther2Validation=false;
$valParts[] = " isValidSum" . $arg['qid'] . "=true;\n"; // assume valid until proven otherwise
$valParts[] = " isValidOther" . $arg['qid'] . "=true;\n"; // assume valid until proven otherwise
$valParts[] = " isValidOtherComment" . $arg['qid'] . "=true;\n"; // assume valid until proven otherwise
Expand All @@ -7388,20 +7386,8 @@ static function GetRelevanceAndTailoringJavaScript()
if ($validationEqn == '') {
continue;
}
if ($vclass == 'sum_range')
{
$_hasSumRange = true;
}
else if ($vclass == 'other_comment_mandatory')
{
$_hasOther2Validation = true;
}
else
{
$_hasOtherValidation = true;
}

$_isValid = $LEM->em->ProcessBooleanExpression($validationEqn,$arg['gseq'],$LEM->questionId2questionSeq[$arg['qid']]);
$LEM->em->ProcessBooleanExpression($validationEqn,$arg['gseq'],$LEM->questionId2questionSeq[$arg['qid']]);
$_vars = $LEM->em->GetJSVarsUsed();
$allJsVarsUsed = array_merge($allJsVarsUsed,$_vars);
$valJsVarsUsed = array_merge($valJsVarsUsed,$_vars);
Expand Down Expand Up @@ -7475,6 +7461,10 @@ static function GetRelevanceAndTailoringJavaScript()
case 'P':
$othervar = 'answer' . substr($arg['jsResultVar'],4);
break;
default:
// TODO: Internal error if this happens
$othervar = '';
break;
}
$valParts[] = "\n if(isValidOtherComment" . $arg['qid'] . "){\n";
$valParts[] = " $('#" . $othervar . "').addClass('em_sq_validation').removeClass('error').addClass('good').trigger('classChangeGood');\n";
Expand Down Expand Up @@ -8063,7 +8053,6 @@ static function UnitTestRelevance()
EOT;

$vars = array();
$varsNAOK = array();
$varSeq = array();
$testArgs = array();
$argInfo = array();
Expand Down Expand Up @@ -8228,7 +8217,6 @@ public static function ShowStackTrace($msg=NULL,&$args=NULL)
if ($count++ == 0){
continue; // skip this call
}
$LEM->debugStack = array();

$subargs=array();
if (!is_null($args) && $log['function'] == 'templatereplace') {
Expand Down

0 comments on commit 04884e9

Please sign in to comment.