summaryrefslogtreecommitdiffstats
path: root/application/models/EventreportMapper.php
diff options
context:
space:
mode:
authorSebastian Wagner2011-10-07 14:26:01 +0200
committerSebastian Wagner2011-10-07 14:26:01 +0200
commit1e393a1662d10d83a7aca2c556ef0aa7e50b6fd5 (patch)
treefe0ab554848a29f66f37f6f7c556caa01baae7ea /application/models/EventreportMapper.php
parentminor (diff)
downloadpoolctrl-1e393a1662d10d83a7aca2c556ef0aa7e50b6fd5.tar.gz
poolctrl-1e393a1662d10d83a7aca2c556ef0aa7e50b6fd5.tar.xz
poolctrl-1e393a1662d10d83a7aca2c556ef0aa7e50b6fd5.zip
new statistic, all_pools implemented
Diffstat (limited to 'application/models/EventreportMapper.php')
-rwxr-xr-xapplication/models/EventreportMapper.php86
1 files changed, 54 insertions, 32 deletions
diff --git a/application/models/EventreportMapper.php b/application/models/EventreportMapper.php
index 309dd18..7f7434e 100755
--- a/application/models/EventreportMapper.php
+++ b/application/models/EventreportMapper.php
@@ -167,51 +167,73 @@ class Application_Model_EventreportMapper
public function getSuccessBarCount($poolID) {
$db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->setIntegrityCheck(false)
- ->from(array('pcr' => 'poolctrl_eventreport'),
- array('count1' => 'SUM(IF(pcr.result="successful",1,0))', 'count0' => 'SUM(IF(pcr.result="failed",1,0))')
- )
- ->join(array('pce' => 'poolctrl_event'),
+ if($poolID != 'all'){
+ $select = $this->getDbTable()->select()
+ ->setIntegrityCheck(false)
+ ->from(array('pcr' => 'poolctrl_eventreport'),
+ array('count1' => 'SUM(IF(pcr.result="successful",1,0))', 'count0' => 'SUM(IF(pcr.result="failed",1,0))')
+ )
+ ->join(array('pce' => 'poolctrl_event'),
+ 'pce.eventID = pcr.eventID',
+ array())
+ ->where('pce.pbs_poolID = ?', $poolID);}
+ else {
+ $select = $this->getDbTable()->select()
+ ->setIntegrityCheck(false)
+ ->from(array('pcr' => 'poolctrl_eventreport'),
+ array('count1' => 'SUM(IF(pcr.result="successful",1,0))', 'count0' => 'SUM(IF(pcr.result="failed",1,0))')
+ )
+ ->join(array('pce' => 'poolctrl_event'),
'pce.eventID = pcr.eventID',
- array())
- ->where('pce.pbs_poolID = ?', $poolID);
+ array());
+ }
- $stmt = $db->query($select);
- $result = $stmt->fetchAll(PDO::FETCH_NUM);
+ $stmt = $db->query($select);
+ $result = $stmt->fetchAll(PDO::FETCH_NUM);
- foreach ($result as $r) {
- $ret1 = array((int)$r[0],'Successful');
- $ret2 = array((int)$r[1],'Failed');
- $return[] = array($ret1,$ret2);
- }
+ foreach ($result as $r) {
+ $ret1 = array((int)$r[0],'Successful');
+ $ret2 = array((int)$r[1],'Failed');
+ $return[] = array($ret1,$ret2);
+ }
- return $return;
+ return $return;
}
public function getSuccessPieCount($poolID) {
$db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->setIntegrityCheck(false)
- ->from(array('pcr' => 'poolctrl_eventreport'),
- array('count1' => 'SUM(IF(pcr.result="successful",1,0))', 'count0' => 'SUM(IF(pcr.result="failed",1,0))')
- )
- ->join(array('pce' => 'poolctrl_event'),
+ if($poolID != 'all'){
+ $select = $this->getDbTable()->select()
+ ->setIntegrityCheck(false)
+ ->from(array('pcr' => 'poolctrl_eventreport'),
+ array('count1' => 'SUM(IF(pcr.result="successful",1,0))', 'count0' => 'SUM(IF(pcr.result="failed",1,0))')
+ )
+ ->join(array('pce' => 'poolctrl_event'),
+ 'pce.eventID = pcr.eventID',
+ array())
+ ->where('pce.pbs_poolID = ?', $poolID);}
+ else {
+ $select = $this->getDbTable()->select()
+ ->setIntegrityCheck(false)
+ ->from(array('pcr' => 'poolctrl_eventreport'),
+ array('count1' => 'SUM(IF(pcr.result="successful",1,0))', 'count0' => 'SUM(IF(pcr.result="failed",1,0))')
+ )
+ ->join(array('pce' => 'poolctrl_event'),
'pce.eventID = pcr.eventID',
- array())
- ->where('pce.pbs_poolID = ?', $poolID);
+ array());
+ }
- $stmt = $db->query($select);
- $result = $stmt->fetchAll(PDO::FETCH_NUM);
+ $stmt = $db->query($select);
+ $result = $stmt->fetchAll(PDO::FETCH_NUM);
- foreach ($result as $r) {
- $ret1 = array('Successful', (int)$r[0]);
- $ret2 = array('Failed', (int)$r[1]);
- $return[] = array($ret1,$ret2);
- }
+ foreach ($result as $r) {
+ $ret1 = array('Successful', (int)$r[0]);
+ $ret2 = array('Failed', (int)$r[1]);
+ $return[] = array($ret1,$ret2);
+ }
- return $return;
+ return $return;
}
}