Skip to content

Commit

Permalink
Fix: pihole ads_percentage_today sometimes returned as string (geth…
Browse files Browse the repository at this point in the history
  • Loading branch information
shamoon authored Apr 16, 2024
1 parent 034f6d2 commit 303a623
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/widgets/pihole/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function Component({ service }) {

let blockedValue = `${t("common.number", { value: parseInt(piholeData.ads_blocked_today, 10) })}`;
if (!widget.fields.includes("blocked_percent")) {
blockedValue += ` (${t("common.percent", { value: parseFloat(piholeData.ads_percentage_today.toPrecision(3)) })})`;
blockedValue += ` (${t("common.percent", { value: parseFloat(piholeData.ads_percentage_today).toPrecision(3) })})`;
}

return (
Expand All @@ -41,7 +41,7 @@ export default function Component({ service }) {
<Block label="pihole.blocked" value={blockedValue} />
<Block
label="pihole.blocked_percent"
value={t("common.percent", { value: parseFloat(piholeData.ads_percentage_today.toPrecision(3)) })}
value={t("common.percent", { value: parseFloat(piholeData.ads_percentage_today).toPrecision(3) })}
/>
<Block
label="pihole.gravity"
Expand Down

0 comments on commit 303a623

Please sign in to comment.