Skip to content

Commit

Permalink
Fixed issue #06186: Array Question Type: EM doesn't convert condition…
Browse files Browse the repository at this point in the history
… correctly, AND becomes OR

Dev ConvertConditionsToRelevance was not ANDing together conditions from different sub-questions within the same question.
Dev the automatic upgrade to database version 155.5 will fix this in the database for all questions
  • Loading branch information
TMSWhite committed Jun 10, 2012
1 parent 2fc3ff5 commit 2ae348b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions classes/expressions/LimeExpressionManager.php
Expand Up @@ -799,6 +799,7 @@ public static function ConvertConditionsToRelevance($surveyId=NULL, $qid=NULL)
$_qid = $row['qid'];
$_scenario = $row['scenario'];
$_cqid = $row['cqid'];
$_fieldname = -1;
$relAndList = array();
$relOrList = array();
$scenarios = array();
Expand All @@ -815,12 +816,14 @@ public static function ConvertConditionsToRelevance($surveyId=NULL, $qid=NULL)
$relOrList = array();
$_scenario = $row['scenario'];
$_cqid = $row['cqid'];
$_fieldname = -1;
}
if ($row['cqid'] != $_cqid)
{
$relAndList[] = '(' . implode(' or ', $relOrList) . ')';
$relOrList = array();
$_cqid = $row['cqid'];
$_fieldname = -1;
}

// fix fieldnames
Expand All @@ -844,6 +847,12 @@ public static function ConvertConditionsToRelevance($surveyId=NULL, $qid=NULL)
$fieldname = $row['cfieldname'] . '.NAOK';
$value = $row['value'];
}
if ($_fieldname != -1 && $_fieldname != $fieldname)
{
$relAndList[] = '(' . implode(' or ', $relOrList) . ')';
$relOrList = array();
}
$_fieldname = $fieldname;

// fix values
if (preg_match('/^@\d+X\d+X\d+.*@$/',$value)) {
Expand Down

0 comments on commit 2ae348b

Please sign in to comment.