Skip to content

Commit

Permalink
Fixed issue #16776 question index marks pages with fully answered que…
Browse files Browse the repository at this point in the history
…stions as unanswered (#1652)

* Fixed issue #16776: Question index marks pages with fully answered questions as unanswered

For Numeric Array question types with Checkbox layout, if is enough for mandatory, we flag it as answered. If not, we flag it as anunserwed.

* Fixed issue #16776: Question index marks pages with fully answered questions as unanswered

For Numeric Array question types with Checkbox layout, if is enough for mandatory, we flag it as answered. If not, we flag it as anunserwed.

* Fixed issue #16776: Question index marks pages with fully answered questions as unanswered

Dummy change to trigger travis
  • Loading branch information
gabrieljenik committed Dec 10, 2020
1 parent 99aae15 commit 4f0bb4e
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -6826,6 +6826,44 @@ function ($sqRankAnwsers) {
}
// what about optional vs. mandatory comment and 'other' fields?
break;

case Question::QT_COLON_ARRAY_MULTI_FLEX_NUMBERS:
$anyUnanswered = false;
$qattr = isset($LEM->qattr[$qid]) ? $LEM->qattr[$qid] : array();
if (isset($qattr['multiflexible_checkbox']) && $qattr['multiflexible_checkbox'] == 1)
{
// For Numeric Array question types with Checkbox layout, if is enough for mandatory, we flag it as answered. If not, we flag it as anunserwed.
// So we use the same logic as for reviewing mandatory violations.

// Need to check whether there is at least one checked box per row
foreach ($LEM->q2subqInfo[$qid]['subqs'] as $sq)
{
if (!isset($_SESSION[$LEM->sessid]['relevanceStatus'][$sq['rowdivid']]) || $_SESSION[$LEM->sessid]['relevanceStatus'][$sq['rowdivid']])
{
$rowCount=0;
$numUnanswered=0;
foreach ($sgqas as $s)
{
if (strpos($s, $sq['rowdivid']."_") !== false) // Test complete subquestion code (#09493)
{
++$rowCount;
if (array_search($s,$unansweredSQs) !== false) {
++$numUnanswered;
}
}
}
if ($rowCount > 0 && $rowCount == $numUnanswered)
{
$anyUnanswered = true;
}
}
}
}
else
{
$anyUnanswered = (count($unansweredSQs) > 0);
}
break;
default:
$anyUnanswered = (count($unansweredSQs) > 0);
break;
Expand Down

0 comments on commit 4f0bb4e

Please sign in to comment.