From ae8f5c2c8506b3c5bc598c306d876bad34af2a7a Mon Sep 17 00:00:00 2001 From: Philemon Ukane Date: Sat, 21 Sep 2024 09:39:39 +0100 Subject: [PATCH] dcrdata/views: fix tspend vote turnout percentage (#2004) - display zero instead of NAN when there are no tspend votes Signed-off-by: Philemon Ukane --- cmd/dcrdata/views/tx.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/dcrdata/views/tx.tmpl b/cmd/dcrdata/views/tx.tmpl index be16bce13..64420eed5 100644 --- a/cmd/dcrdata/views/tx.tmpl +++ b/cmd/dcrdata/views/tx.tmpl @@ -396,7 +396,7 @@ Votes Cast: {{.TotalVotes}} - ({{printf "%.0f" (percentage .TotalVotes .EligibleVotes)}}% turnout) + ({{if gt .TotalVotes 0}}{{printf "%.0f" (percentage .TotalVotes .EligibleVotes)}}{{else}}0{{end}}% turnout) {{if not .Approved}} Voting Ends In: