Skip to content

Commit

Permalink
Dev Fixed duplicate query
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Jan 22, 2018
1 parent c4c1678 commit 0c7ab87
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions application/controllers/admin/questions.php
Expand Up @@ -1289,15 +1289,13 @@ public function index($sa, $surveyid, $gid, $qid = null)

$aData['action'] = $action;

$sumresult1 = Survey::model()->findByPk($surveyid);
if (is_null($sumresult1)) {
$arSurveyInfo = Survey::model()->findByPk($surveyid);
if (is_null($arSurveyInfo)) {
$this->getController()->error('Invalid Survey ID');
}

// $surveyinfo = $sumresult1->attributes;
// $surveyinfo = array_map('flattenText', $surveyinfo);
$aData['activated'] = $activated = $sumresult1->active;

$aData['activated'] = $arSurveyInfo->active;

// Prepare selector Class for javascript function
if (Yii::app()->session['questionselectormode'] !== 'default') {
$selectormodeclass = Yii::app()->session['questionselectormode'];
Expand All @@ -1318,7 +1316,7 @@ public function index($sa, $surveyid, $gid, $qid = null)

if ($adding) {
// Get the questions for this group
$baselang = Survey::model()->findByPk($surveyid)->language;
$baselang = $arSurveyInfo->language;
$oqresult = Question::model()->findAllByAttributes(array('sid' => $surveyid, 'gid' => $gid, 'language' => $baselang, 'parent_qid'=> 0), array('order' => 'question_order'));
$aData['oqresult'] = $oqresult;
}
Expand Down

0 comments on commit 0c7ab87

Please sign in to comment.