summary refs log tree commit diff
diff options
context:
space:
mode:
authorSam Lade <sam@sentynel.com>2023-12-16 19:12:25 +0000
committertobi <tobi.smethurst@protonmail.com>2024-01-10 13:53:18 +0100
commitb141500e54ddbdb975ad2831842ff3e8fae997df (patch)
tree9c0578cffc90b0f6ebfb0655901a967943c4d79e
parentf4fcffc8b56ef73c184ae17892b69181961c15c7 (diff)
fix poll total vote double count (#2464)
-rw-r--r--internal/typeutils/internaltofrontend.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go
index 353c719b..09d538a3 100644
--- a/internal/typeutils/internaltofrontend.go
+++ b/internal/typeutils/internaltofrontend.go
@@ -1484,6 +1484,9 @@ func (c *Converter) PollToAPIPoll(ctx context.Context, requester *gtsmodel.Accou
 		// disabled, or the requester is the author
 		// do we actually populate the vote counts.
 
+		// If we voted in this poll, we'll have set totalVotes
+		// earlier. Reset here to avoid double counting.
+		totalVotes = 0
 		if *poll.Multiple {
 			// The total number of voters are only
 			// provided in the case of a multiple