We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 72bfa88 commit 7950d89Copy full SHA for 7950d89
library/Icingadb/ProvidedHook/Reporting/Common/SlaTimeline.php
@@ -62,9 +62,9 @@ public function setInitialHardState(int $state): self
62
/**
63
* Get the calculated SLA result of this timeline
64
*
65
- * @return float
+ * @return ?float
66
*/
67
- public function getResult(): float
+ public function getResult(): ?float
68
{
69
$problemTime = 0;
70
$activeDowntimes = 0;
@@ -97,6 +97,10 @@ public function getResult(): float
97
$this->problemTime = $problemTime;
98
$this->totalTime = $totalTime;
99
100
+ if ($totalTime <= 0) {
101
+ return null;
102
+ }
103
+
104
return 100 * ($totalTime - $problemTime) / $totalTime;
105
}
106
0 commit comments