uptime uptime variable location & unnecessary variables

This commit is contained in:
Doruk 2025-06-25 15:18:21 +02:00
parent b121cc7d5c
commit 71b73e979f
2 changed files with 3 additions and 5 deletions

View file

@ -97,7 +97,6 @@ router.get("/api/status-page/heartbeat/:slug", cache("1 minutes"), async (reques
const uptimeCalculator = await UptimeCalculator.getUptimeCalculator(monitorID);
let heartbeats;
let uptime;
if (heartbeatBarDays === 0) {
// Auto mode - use original LIMIT 100 logic
@ -134,6 +133,7 @@ router.get("/api/status-page/heartbeat/:slug", cache("1 minutes"), async (reques
}
// Calculate uptime based on the range
let uptime;
if (heartbeatBarDays <= 1) {
uptime = uptimeCalculator.get24Hour().uptime;
} else {

View file

@ -30,10 +30,8 @@ export default {
return this.$t("statusMaintenance");
}
let key = this.monitor.id;
if (this.$root.uptimeList[key] !== undefined) {
let result = Math.round(this.$root.uptimeList[key] * 10000) / 100;
if (this.$root.uptimeList[this.monitor.id] !== undefined) {
let result = Math.round(this.$root.uptimeList[this.monitor.id] * 10000) / 100;
// Only perform sanity check on status page. See louislam/uptime-kuma#2628
if (this.$route.path.startsWith("/status") && result > 100) {
return "100%";