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

This commit is contained in:
M M
2024-08-31 19:59:27 -07:00
parent 01fdf7983f
commit 7866936d3a

View File

@@ -35,10 +35,10 @@ const createCheck = async (checkData) => {
}
if (monitor.uptimePercentage === undefined) {
monitor.uptimePercentage = status ? 100 : 0;
monitor.uptimePercentage = status ? 1 : 0;
} else {
monitor.uptimePercentage =
(monitor.uptimePercentage * (n - 1) + (status ? 100 : 0)) / n;
(monitor.uptimePercentage * (n - 1) + (status ? 1: 0)) / n;
}
await monitor.save();