fix: Calculate votes as a percent
All checks were successful
Build Docker / Build Image (push) Successful in 28s

This commit is contained in:
Nathan Woodburn 2024-02-25 22:55:51 +11:00
parent 84f8388e39
commit 71fff60b08
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -13,7 +13,7 @@ def votes():
# Check if message is json
if 'votes' not in vote:
continue
weight = int(vote["votes"])
weight = int(vote["votes"]) / 100
if vote["message"].startswith("{"):
message = json.loads(vote["message"])
for key in message:
@ -23,9 +23,9 @@ def votes():
options[key] = (int(message[key]) * weight)
continue
if vote["message"] in options:
options[vote["message"]] += weight
options[vote["message"]] += weight * 100
else:
options[vote["message"]] = weight
options[vote["message"]] = weight * 100
labels = list(options.keys())