Skip to content

Commit

Permalink
Dev Don't crash out if invalid QID is used
Browse files Browse the repository at this point in the history
Dev Statistics graphs now don't cache if debug=2
  • Loading branch information
c-schmitz committed Apr 23, 2013
1 parent 4a2cef6 commit e8c5276
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion application/core/Survey_Common_Action.php
Expand Up @@ -351,7 +351,7 @@ function _questionbar($iSurveyID, $gid, $qid, $action = null)
$aData['sqct'] = $sqct = count($sqrq);

$qrrow = Questions::model()->findByAttributes(array('qid' => $qid, 'gid' => $gid, 'sid' => $iSurveyID, 'language' => $baselang));

if (is_null($qrrow)) return;
$questionsummary = "<div class='menubar'>\n";

// Check if other questions in the Survey are dependent upon this question
Expand Down
13 changes: 3 additions & 10 deletions application/helpers/admin/statistics_helper.php
Expand Up @@ -65,8 +65,7 @@ function createChart($iQuestionID, $iSurveyID, $type=null, $lbl, $gdata, $grawda
if (count($lbl)>72)
{
$DataSet = array(1=>array(1=>1));
if ($cache->IsInCache("graph".$language.$iSurveyID,$DataSet))
{
if ($cache->IsInCache("graph".$language.$iSurveyID,$DataSet) && Yii::app()->getConfig('debug')<2) {
$cachefilename=basename($cache->GetFileFromCache("graph".$language.$iSurveyID,$DataSet));
}
else
Expand Down Expand Up @@ -165,13 +164,8 @@ function createChart($iQuestionID, $iSurveyID, $type=null, $lbl, $gdata, $grawda
$DataSet->SetSerieName(html_entity_decode($sLabelName,null,'UTF-8'), "Serie$counter");
$counter++;
}





if ($cache->IsInCache("graph".$language.$iSurveyID,$DataSet->GetData()))
{
if ($cache->IsInCache("graph".$language.$iSurveyID,$DataSet->GetData()) && Yii::app()->getConfig('debug')<2) {
$cachefilename=basename($cache->GetFileFromCache("graph".$language.$iSurveyID,$DataSet->GetData()));
}
else
Expand Down Expand Up @@ -260,8 +254,7 @@ function createChart($iQuestionID, $iSurveyID, $type=null, $lbl, $gdata, $grawda
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");

if ($cache->IsInCache("graph".$language.$iSurveyID, $DataSet->GetData()))
{
if ($cache->IsInCache("graph".$language.$iSurveyID, $DataSet->GetData()) && Yii::app()->getConfig('debug')<2) {
$cachefilename=basename($cache->GetFileFromCache("graph".$language.$iSurveyID,$DataSet->GetData()));
}
else
Expand Down

0 comments on commit e8c5276

Please sign in to comment.