[icinga-checkins] icinga.org: icinga-web/master: * Fixed duration error, thanks TG ( fixes #2256)

git at icinga.org git at icinga.org
Fri Feb 10 17:02:11 CET 2012


Module: icinga-web
Branch: master
Commit: e464312d84cfbd7d3fe8c18384e98a6a9261714b
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=e464312d84cfbd7d3fe8c18384e98a6a9261714b

Author: Marius Hein <marius.hein at netways.de>
Date:   Fri Feb 10 17:01:23 2012 +0100

* Fixed duration error, thanks TG (fixes #2256)

---

 .../models/ColumnDisplay/DurationModel.class.php   |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/app/modules/Cronks/models/ColumnDisplay/DurationModel.class.php b/app/modules/Cronks/models/ColumnDisplay/DurationModel.class.php
index 895d118..c156396 100644
--- a/app/modules/Cronks/models/ColumnDisplay/DurationModel.class.php
+++ b/app/modules/Cronks/models/ColumnDisplay/DurationModel.class.php
@@ -9,15 +9,13 @@ class Cronks_ColumnDisplay_DurationModel extends CronksBaseModel implements Agav
     public function initialize(AgaviContext $context, array $parameters = array()) {
         parent::initialize($context, $parameters);
         
-        $model = $this->getContext()->getModel("ApiDataRequest","Api");
-        
-        $this->serviceQuery = $model->createRequestDescriptor()->select('ss.servicestatus_id, ss.last_state_change')
+        $this->serviceQuery = IcingaDoctrine_Query::create()->select('ss.servicestatus_id, ss.last_state_change')
         ->from('IcingaServicestatus ss')
         ->innerJoin('ss.instance i')
         ->innerJoin('i.programstatus p')
         ->andWhere('ss.service_object_id=?');
         
-        $this->hostQuery = $model->createRequestDescriptor()->select()
+        $this->hostQuery = IcingaDoctrine_Query::create()->select()
         ->from('IcingaHoststatus hs')
         ->innerJoin('hs.instance i')
         ->innerJoin('i.programstatus p')
@@ -70,10 +68,11 @@ class Cronks_ColumnDisplay_DurationModel extends CronksBaseModel implements Agav
                     's' => 1
         );
         
+        $new_val = $this->context->getTranslationManager()->_d($val, 'date-tstamp');
+        
         $tstamp = strtotime($val);
         
         $diff = time() - $tstamp;
-        
         if ($diff > 0) {
             $out = array ();
             foreach ($durationMap as $k=>$v) {
@@ -81,7 +80,7 @@ class Cronks_ColumnDisplay_DurationModel extends CronksBaseModel implements Agav
                 if ($diff===$m) {
                     continue;
                 } else {
-                    $out[] = ceil($diff/$v).$k;
+                    $out[] = floor($diff/$v).$k;
                     $diff = $m;
                 }
         





More information about the icinga-checkins mailing list