Skip to content

Commit

Permalink
Fixed issue: Graph type in statistics not being properly stored
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Jun 25, 2015
1 parent ab59fae commit eb83629
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion application/models/QuestionAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,18 @@ public function rules()
public function setQuestionAttribute($iQuestionID,$sAttributeName, $sValue)
{
$oModel = new self;
$oModel->updateAll(array('value'=>$sValue),'attribute=:attributeName and qid=:questionID',array(':attributeName'=>$sAttributeName,':questionID'=>$iQuestionID));
if (!empty($oModel->findAll('attribute=:attributeName and qid=:questionID',array(':attributeName'=>$sAttributeName,':questionID'=>$iQuestionID))))
{
$oModel->updateAll(array('value'=>$sValue),'attribute=:attributeName and qid=:questionID',array(':attributeName'=>$sAttributeName,':questionID'=>$iQuestionID));
}
else
{
$oModel = new self;
$oModel->attribute=$sAttributeName;
$oModel->value=$sValue;
$oModel->qid=$iQuestionID;
$oModel->save();
}
return Yii::app()->db->createCommand()
->select()
->from($this->tableName())
Expand Down

0 comments on commit eb83629

Please sign in to comment.