-
Notifications
You must be signed in to change notification settings - Fork 994
Commit
Dev: Moved methods from common_helper into the model. Kept compatibility link.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,6 +186,7 @@ function index($iSurveyId, $quickreport = false) | |
foreach ($oSurvey->quotas as $oQuota) | ||
{ | ||
$totalquotas += $oQuota->qlimit; | ||
$completed = 0; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
lacrioque
Author
Contributor
|
||
$completed = getQuotaCompletedCount($iSurveyId, $oQuota->primaryKey); | ||
$totalcompleted = $totalcompleted + $completed; | ||
$csvoutput[] = $oQuota->name . "," . $oQuota->qlimit . "," . $completed . "," . ($oQuota->qlimit - $completed) . "\r\n"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,11 +154,40 @@ function deleteQuota($condition = false, $recursive = true) | |
* @return QuotaLanguageSetting | ||
*/ | ||
public function getMainLanguagesetting(){ | ||
return QuotaLanguageSetting::model() | ||
->with(array('quota' => array('condition' => 'sid="'.$this->survey->primaryKey.'"'))) | ||
->findByAttributes(array( | ||
'quotals_language'=>$this->survey->language, | ||
)); | ||
return $this->languagesettings[ $this->survey->language ]; | ||
|
||
} | ||
|
||
public function getCompleteCount(){ | ||
// if(!tableExists("survey_{$this->survey->id}")) // Yii::app()->db->schema->getTable('{{survey_' . $iSurveyId . '}}' are not updated even after Yii::app()->db->schema->refresh(); | ||
// return; | ||
|
||
if (count($this->quotaMembers) > 0) | ||
{ | ||
// Keep a list of fields for easy reference | ||
$aQuotaColumns = array(); | ||
foreach ($this->quotaMembers as $member) | ||
{ | ||
$aQuotaColumns[$member->memberInfo['fieldname']][] = $member->memberInfo['value']; | ||
} | ||
|
||
$oCriteria = new CDbCriteria; | ||
$oCriteria->condition="submitdate IS NOT NULL"; | ||
foreach ($aQuotaColumns as $sColumn=>$aValue) | ||
{ | ||
if(count($aValue)==1) | ||
{ | ||
$oCriteria->compare(Yii::app()->db->quoteColumnName($sColumn),$aValue); // NO need params : compare bind | ||
This comment has been minimized.
Sorry, something went wrong.
LouisGac
Contributor
|
||
} | ||
else | ||
{ | ||
$oCriteria->addInCondition(Yii::app()->db->quoteColumnName($sColumn),$aValue); // NO need params : addInCondition bind | ||
} | ||
} | ||
return SurveyDynamic::model($this->survey->sid)->count($oCriteria); | ||
} else { | ||
return 0; | ||
} | ||
} | ||
|
||
/** | ||
|
did you checked if this was making any problem when completed != 0 ?