diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Model/Tick.php | 24 | ||||
-rw-r--r-- | lib/Service/RunningService.php | 8 |
2 files changed, 27 insertions, 5 deletions
diff --git a/lib/Model/Tick.php b/lib/Model/Tick.php index 46bb7b2..3a9efc2 100644 --- a/lib/Model/Tick.php +++ b/lib/Model/Tick.php @@ -63,7 +63,7 @@ class Tick { private $status; /** @var string */ - private $action; + private $action = ''; /** @@ -234,6 +234,18 @@ class Tick { /** * @param string $info + * @param float $value + * + * @return $this + */ + public function setInfoFloat(string $info, float $value): Tick { + $this->data[$info] = $value; + + return $this; + } + + /** + * @param string $info */ public function unsetInfo(string $info) { unset($this->data[$info]); @@ -260,5 +272,15 @@ class Tick { return $this->getInt($info, $this->data, $default); } + /** + * @param string $info + * @param float $default + * + * @return float + */ + public function getInfoFloat(string $info, float $default = 0): float { + return $this->getFloat($info, $this->data, $default); + } + } diff --git a/lib/Service/RunningService.php b/lib/Service/RunningService.php index 0527a63..a182f0b 100644 --- a/lib/Service/RunningService.php +++ b/lib/Service/RunningService.php @@ -238,18 +238,18 @@ class RunningService { $preAction = $tick->getAction(); if ($preAction !== '') { - $preActionTotal = $tick->getInfoInt($preAction . 'Total', 0); - $preActionStart = $tick->getInfoInt($preAction . 'Init', 0); + $preActionTotal = $tick->getInfoFloat($preAction . 'Total', 0); + $preActionStart = $tick->getInfoFloat($preAction . 'Init', 0); if ($preActionStart > 0) { $preActionTotal += ($now - $preActionStart); - $tick->setInfoInt($preAction . 'Total', $preActionTotal); + $tick->setInfoFloat($preAction . 'Total', $preActionTotal); $tick->unsetInfo($preAction . 'Init'); } } $tick->setAction($action) - ->setInfoInt($action . 'Init', $now); + ->setInfoFloat($action . 'Init', $now); } |