Skip to content

Commit

Permalink
Fixed issue #17984: Using RemoteControl method list_questions does no…
Browse files Browse the repository at this point in the history
…t return subquestions (#2345)
  • Loading branch information
gabrieljenik committed Apr 27, 2022
1 parent 4ca5c39 commit 1c677f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions application/helpers/remotecontrol/remotecontrol_handle.php
Original file line number Diff line number Diff line change
Expand Up @@ -2307,10 +2307,10 @@ public function list_questions($sSessionKey, $iSurveyID, $iGroupID = null, $sLan
if ($oGroup->sid != $oSurvey->sid) {
return ['status' => 'Error: Mismatch in surveyid and groupid'];
} else {
$aQuestionList = $oGroup->questions;
$aQuestionList = $oGroup->allQuestions;
}
} else {
$aQuestionList = $oSurvey->baseQuestions;
$aQuestionList = $oSurvey->allQuestions;
}

if (count($aQuestionList) == 0) {
Expand Down
11 changes: 11 additions & 0 deletions application/models/QuestionGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,4 +475,15 @@ public static function getTotalGroupsWithQuestions($surveyid)

return $result;
}

/**
* Returns all group questions (including subquestions)
* @return Question[]
*/
public function getAllQuestions()
{
/** @var Question[] $questions */
$questions = Question::model()->findAllByAttributes(['gid' => $this->gid]);
return $questions;
}
}

0 comments on commit 1c677f7

Please sign in to comment.