make uptimeSince actually filter by timestamps
This commit is contained in:
parent
bc2cb0de45
commit
7136b827d3
@ -56,8 +56,8 @@ type
|
|||||||
uptimePercent: float
|
uptimePercent: float
|
||||||
|
|
||||||
proc uptimeSince(sid: int, time: Time): float =
|
proc uptimeSince(sid: int, time: Time): float =
|
||||||
let okPings = fromDbValue(get getDB().value("SELECT COUNT(*) FROM reqs WHERE site = ? AND status <= 0", sid), int)
|
let okPings = fromDbValue(get getDB().value("SELECT COUNT(*) FROM reqs WHERE site = ? AND status <= 0 AND timestamp >= ?", sid, time), int)
|
||||||
let totalPings = fromDbValue(get getDB().value("SELECT COUNT(*) FROM reqs WHERE site = ?", sid), int)
|
let totalPings = fromDbValue(get getDB().value("SELECT COUNT(*) FROM reqs WHERE site = ? AND timestamp >= ?", sid, time), int)
|
||||||
okPings / totalPings
|
okPings / totalPings
|
||||||
|
|
||||||
proc fetchLatest(row: ResultRow): Option[SiteStatus] =
|
proc fetchLatest(row: ResultRow): Option[SiteStatus] =
|
||||||
|
Loading…
Reference in New Issue
Block a user