Skip to content

Commit

Permalink
Fix: Incorrect calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
chakflying committed Dec 22, 2023
1 parent 973d9ca commit 12a4dd3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/uptime-calculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,25 +582,29 @@ class UptimeCalculator {
if (this.lastDailyUptimeData) {
total = this.lastDailyUptimeData;
totalPing = total.avgPing * total.up;
} else {
return uptimeData;
}
break;
case "hour":
if (this.lastHourlyUptimeData) {
total = this.lastHourlyUptimeData;
totalPing = total.avgPing * total.up;
} else {
return uptimeData;
}
break;
case "minute":
if (this.lastUptimeData) {
total = this.lastUptimeData;
totalPing = total.avgPing * total.up;
} else {
return uptimeData;
}
break;
default:
throw new Error("Invalid type");
}

return uptimeData;
}

let avgPing;
Expand Down

0 comments on commit 12a4dd3

Please sign in to comment.