Skip to content

Commit

Permalink
Fixed issue #17330: Ranking Question issue with mandatory setting (#1941
Browse files Browse the repository at this point in the history
)
  • Loading branch information
gabrieljenik committed Jul 13, 2021
1 parent 4dfc823 commit 50d949a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -6671,11 +6671,19 @@ function ($sqRankAnwsers) {
}
break;
case 'R':
if (count($unansweredSQs) > 0)
{
$qattr = isset($LEM->qattr[$qid]) ? $LEM->qattr[$qid] : array();
// If min_answers or max_answers is set, we check that at least one answer is ranked.
// But, if no limit is set, then all answers must be ranked.
if (!empty($qattr['min_answers']) || !empty($qattr['max_answers'])) {
$maxUnrankedAnswers = count($relevantSQs) - 1;
$sMandatoryText = $LEM->gT('Please rank the items.');
} else {
$maxUnrankedAnswers = 0;
$sMandatoryText = $LEM->gT('Please rank all items.');
}
if (count($unansweredSQs) > $maxUnrankedAnswers) {
$qmandViolation = true; // TODO - what about 'other'?
}
$sMandatoryText = $LEM->gT('Please rank all items.');
$mandatoryTip .= Yii::app()->getController()->renderPartial('//survey/questions/question_help/mandatory_tip', array(
'sMandatoryText'=>$sMandatoryText,
), true);
Expand Down

0 comments on commit 50d949a

Please sign in to comment.