Store the percentage as a 0 and 1 instead of 0 - 100 for future calculations.

This commit is contained in:
M M committed 2024-08-31 19:59:27 -07:00
1 parent 01fdf7983f
commit 7866936d3a
1 file changed
+2 -2
+2 -2
View File
@@ -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();