From e436fee45dee956d7cf5f0fbcf9758d6af57f00a Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Wed, 16 Nov 2011 16:09:02 +0100 Subject: more clean up --- application/models/EventreportMapper.php | 50 +++++++------------------------- 1 file changed, 10 insertions(+), 40 deletions(-) (limited to 'application/models/EventreportMapper.php') 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; - } - } -- cgit v1.2.3-55-g7522