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 Apr 4, 2012
1 parent 65cdd51 commit 3ed8d54
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
39 changes: 38 additions & 1 deletion application/helpers/expressions/em_manager_helper.php
Expand Up @@ -4263,7 +4263,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 @@ -4273,6 +4272,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[$LEM->sessid]['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 application/helpers/qanda_helper.php
Expand Up @@ -6024,7 +6024,7 @@ function do_array_multiflexi($ia)
}
else
{
$myvalue = '0';
$myvalue = '';
$setmyvalue = '';
}
$answer .= "\t<td class=\"answer_cell_00$ld question-item answer-item {$answertypeclass}-item\">\n"
Expand Down

0 comments on commit 3ed8d54

Please sign in to comment.