From 09c37838da294dafcb0bbf87c911fd0c65bbd933 Mon Sep 17 00:00:00 2001 From: Philemon Ukane Date: Tue, 27 Aug 2024 23:26:30 +0100 Subject: [PATCH] dcrdata/views: fix tspend vote turnout percentage - 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: