Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/fulltextsearch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2018-11-01 23:17:31 +0300
committerMaxence Lange <maxence@artificial-owl.com>2018-11-01 23:17:31 +0300
commitc14fef4cd5d1d06f590ecdde94246f90b17af69a (patch)
tree242176ff624835e96d340237d95c428800cc5d9c /lib
parent8dffae6d2c7be5e767886c5a5a51cd500b1ef1b5 (diff)
better use float
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Model/Tick.php24
-rw-r--r--lib/Service/RunningService.php8
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);
}