summaryrefslogtreecommitdiffstats
path: root/application/models
diff options
context:
space:
mode:
authorSebastian Wagner2011-10-06 19:48:46 +0200
committerSebastian Wagner2011-10-06 19:48:46 +0200
commit48674fdcb55c9cbda1d21b6609a45113219aedd3 (patch)
tree1f95bf5972915b86258a2d5646978b1aa45c43a0 /application/models
parentMerge branch 'master' of git.openslx.org:lsfks/projekte/poolctrl (diff)
downloadpoolctrl-48674fdcb55c9cbda1d21b6609a45113219aedd3.tar.gz
poolctrl-48674fdcb55c9cbda1d21b6609a45113219aedd3.tar.xz
poolctrl-48674fdcb55c9cbda1d21b6609a45113219aedd3.zip
successfulPlot implemented
Diffstat (limited to 'application/models')
-rwxr-xr-xapplication/models/EventreportMapper.php50
1 files changed, 49 insertions, 1 deletions
diff --git a/application/models/EventreportMapper.php b/application/models/EventreportMapper.php
index a78ee73..309dd18 100755
--- a/application/models/EventreportMapper.php
+++ b/application/models/EventreportMapper.php
@@ -114,7 +114,7 @@ class Application_Model_EventreportMapper
if($eventreport == null){
$return = true;
-
+
}
if($return) {
@@ -164,7 +164,55 @@ class Application_Model_EventreportMapper
return array_diff($vv1,$vv2);
}
+ 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'),
+ 'pce.eventID = pcr.eventID',
+ array())
+ ->where('pce.pbs_poolID = ?', $poolID);
+
+ $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);
+ }
+
+ 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'),
+ 'pce.eventID = pcr.eventID',
+ array())
+ ->where('pce.pbs_poolID = ?', $poolID);
+
+ $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);
+ }
+
+ return $return;
+ }
}