Skip to content

Commit

Permalink
Fixed issue #6463 : Unable to add answers
Browse files Browse the repository at this point in the history
Dev : child of http://git.io/gMMTUg
  • Loading branch information
Shnoulle committed Aug 10, 2012
1 parent b317901 commit afbed20
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions application/controllers/admin/question.php
Expand Up @@ -314,14 +314,16 @@ public function _editansweroptions($surveyid, $gid, $qid)
$qresult = Answers::model()->count($ans);

if ((int)$qresult==0)
{
$oAnswer= new Answers;
$oAnswer->qid = $qid;
$oAnswer->code = 'A1';
$oAnswer->answer = $clang->gT('Some example answer option');
$oAnswer->language = $baselang;
$oAnswer->sortorder = 0;
$oAnswer->scale_id = $i;
$oAnswer->save();
$oAnswer->qid = $qid;
$oAnswer->code = 'A1';
$oAnswer->answer = $clang->gT('Some example answer option');
$oAnswer->language = $baselang;
$oAnswer->sortorder = 0;
$oAnswer->scale_id = $i;
$oAnswer->save();
}
}


Expand All @@ -336,21 +338,23 @@ public function _editansweroptions($surveyid, $gid, $qid)

// Means that no record for the language exists in the answers table
if (empty($iAnswerCount))
{
foreach (Answers::model()->findAllByAttributes(array(
'qid' => $qid,
'scale_id' => $i,
'language' => $baselang
)) as $answer)

$oAnswer= new Answers;
$oAnswer->qid = $answer->qid;
$oAnswer->code = $answer->code;
$oAnswer->answer = $answer->answer;
$oAnswer->language = $language;
$oAnswer->sortorder = $answer->sortorder;
$oAnswer->scale_id = $i;
$oAnswer->assessment_value = $answer->assessment_value;
$oAnswer->save();
$oAnswer= new Answers;
$oAnswer->qid = $answer->qid;
$oAnswer->code = $answer->code;
$oAnswer->answer = $answer->answer;
$oAnswer->language = $language;
$oAnswer->sortorder = $answer->sortorder;
$oAnswer->scale_id = $i;
$oAnswer->assessment_value = $answer->assessment_value;
$oAnswer->save();
}
}
}

Expand Down

0 comments on commit afbed20

Please sign in to comment.