Skip to content

Commit

Permalink
Fixed issue #05948: Mandatory directive for question is ignored for a…
Browse files Browse the repository at this point in the history
…rray (numbers) using checkbox layout
  • Loading branch information
TMSWhite committed Mar 24, 2012
1 parent 1d66d91 commit 1ef189d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
39 changes: 38 additions & 1 deletion classes/expressions/LimeExpressionManager.php
Expand Up @@ -4232,7 +4232,6 @@ function _ValidateQuestion($questionSeq)
case 'F':
case 'J':
case 'H':
case ':':
case ';':
case '1':
// In general, if any relevant questions aren't answered, then it violates the mandatory rule
Expand All @@ -4242,6 +4241,44 @@ function _ValidateQuestion($questionSeq)
}
$mandatoryTip .= $LEM->gT('Please complete all parts').'.';
break;
case ':':
$qattr = isset($LEM->qattr[$qid]) ? $LEM->qattr[$qid] : array();
if (isset($qattr['multiflexible_checkbox']) && $qattr['multiflexible_checkbox'] == 1)
{
// Need to check whether there is at least one checked box per row
foreach ($LEM->subQrelInfo[$qid] as $sq)
{
if ($_SESSION['relevanceStatus'][$sq['rowdivid']])
{
$rowCount=0;
$numUnanswered=0;
foreach ($sgqas as $s)
{
if (strpos($s, $sq['rowdivid']) !== false)
{
++$rowCount;
if (array_search($s,$unansweredSQs) !== false) {
++$numUnanswered;
}
}
}
if ($rowCount > 0 && $rowCount == $numUnanswered)
{
$qmandViolation = true;
}
}
}
$mandatoryTip .= $LEM->gT('Please check at least one box per row').'.';
}
else
{
if (count($unansweredSQs) > 0)
{
$qmandViolation = true; // TODO - what about 'other'?
}
$mandatoryTip .= $LEM->gT('Please complete all parts').'.';
}
break;
case 'R':
if (count($unansweredSQs) > 0)
{
Expand Down
2 changes: 1 addition & 1 deletion qanda.php
Expand Up @@ -5999,7 +5999,7 @@ function do_array_multiflexi($ia)
}
else
{
$myvalue = '0';
$myvalue = '';
$setmyvalue = '';
}
$answer .= "\t<td class=\"answer_cell_00$ld\">\n"
Expand Down

2 comments on commit 1ef189d

@TMSWhite
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be ported to Yii

@TMSWhite
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Please sign in to comment.