Store the percentage as a 0 and 1 instead of 0 - 100 for future calculations.
This commit is contained in:
1 parent
01fdf7983f
commit
7866936d3a
1 file changed
+2
-2
@@ -35,10 +35,10 @@ const createCheck = async (checkData) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (monitor.uptimePercentage === undefined) {
|
if (monitor.uptimePercentage === undefined) {
|
||||||
monitor.uptimePercentage = status ? 100 : 0;
|
monitor.uptimePercentage = status ? 1 : 0;
|
||||||
} else {
|
} else {
|
||||||
monitor.uptimePercentage =
|
monitor.uptimePercentage =
|
||||||
(monitor.uptimePercentage * (n - 1) + (status ? 100 : 0)) / n;
|
(monitor.uptimePercentage * (n - 1) + (status ? 1: 0)) / n;
|
||||||
}
|
}
|
||||||
|
|
||||||
await monitor.save();
|
await monitor.save();
|
||||||
|
|||||||
Reference in new issue
Block a user