From e2b9771f0521b73eae1bf8f2a8e61e62c555c2f7 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 7 Sep 2024 06:25:27 +0200 Subject: [PATCH] Convert q/s to q/m if there aren't all that many queries on this Pi-hole Signed-off-by: DL6ER --- scripts/pi-hole/js/footer.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/pi-hole/js/footer.js b/scripts/pi-hole/js/footer.js index 201037d4..b9cffcd5 100644 --- a/scripts/pi-hole/js/footer.js +++ b/scripts/pi-hole/js/footer.js @@ -234,13 +234,23 @@ function updateInfo() { } function updateQueryFrequency(intl, frequency) { + let freq = parseFloat(frequency); + let unit = "q/s"; + let title = "Queries per second"; + if (freq < 0.5) { + freq *= 60; + unit = "q/m"; + title = "Queries per minute"; + } + $("#query_frequency") .html( - '  ' + - intl.format(parseFloat(frequency)) + - " q/s" + '  ' + + intl.format(freq) + + " " + + unit ) - .attr("title", "Queries per second"); + .attr("title", title); } var ftlinfoTimer = null;