summaryrefslogtreecommitdiffstats
path: root/application/models/EventreportMapper.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/models/EventreportMapper.php')
-rwxr-xr-xapplication/models/EventreportMapper.php50
1 files changed, 10 insertions, 40 deletions
diff --git a/application/models/EventreportMapper.php b/application/models/EventreportMapper.php
index da37e66..371fa26 100755
--- a/application/models/EventreportMapper.php
+++ b/application/models/EventreportMapper.php
@@ -164,7 +164,7 @@ class Application_Model_EventreportMapper
return array_diff_assoc($vv1,$vv2);
}
- public function getSuccessBarCount($poolID) {
+ public function getSuccessPlotdata($poolID, $plotType) {
$db = Zend_Db_Table::getDefaultAdapter();
if($poolID != 'all'){
@@ -192,49 +192,19 @@ class Application_Model_EventreportMapper
$result = $stmt->fetchAll(PDO::FETCH_NUM);
foreach ($result as $r) {
- $ret1 = array((int)$r[0],'Succeeded');
- $ret2 = array((int)$r[1],'Failed');
- $return[] = array($ret1,$ret2);
+ if($plotType == 1) {
+ $ret1 = array((int)$r[0],'Succeeded');
+ $ret2 = array((int)$r[1],'Failed');
+ $return[] = array($ret1,$ret2);
+ } else if($plotType == 2) {
+ $ret1 = array('Successful', (int)$r[0]);
+ $ret2 = array('Failed', (int)$r[1]);
+ $return[] = array($ret1,$ret2);
+ }
}
return $return;
}
- public function getSuccessPieCount($poolID) {
-
- $db = Zend_Db_Table::getDefaultAdapter();
- if($poolID != 'all'){
- $select = $this->getDbTable()->select()
- ->setIntegrityCheck(false)
- ->from(array('pcr' => 'poolctrl_eventreport'),
- array('count1' => 'SUM(IF(pcr.result="succeeded",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="succeeded",1,0))', 'count0' => 'SUM(IF(pcr.result="failed",1,0))')
- )
- ->join(array('pce' => 'poolctrl_event'),
- 'pce.eventID = pcr.eventID',
- array());
- }
-
- $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;
- }
-
}