fix: Calculate votes as a percent
All checks were successful
Build Docker / Build Image (push) Successful in 28s
All checks were successful
Build Docker / Build Image (push) Successful in 28s
This commit is contained in:
parent
84f8388e39
commit
71fff60b08
@ -13,7 +13,7 @@ def votes():
|
|||||||
# Check if message is json
|
# Check if message is json
|
||||||
if 'votes' not in vote:
|
if 'votes' not in vote:
|
||||||
continue
|
continue
|
||||||
weight = int(vote["votes"])
|
weight = int(vote["votes"]) / 100
|
||||||
if vote["message"].startswith("{"):
|
if vote["message"].startswith("{"):
|
||||||
message = json.loads(vote["message"])
|
message = json.loads(vote["message"])
|
||||||
for key in message:
|
for key in message:
|
||||||
@ -23,9 +23,9 @@ def votes():
|
|||||||
options[key] = (int(message[key]) * weight)
|
options[key] = (int(message[key]) * weight)
|
||||||
continue
|
continue
|
||||||
if vote["message"] in options:
|
if vote["message"] in options:
|
||||||
options[vote["message"]] += weight
|
options[vote["message"]] += weight * 100
|
||||||
else:
|
else:
|
||||||
options[vote["message"]] = weight
|
options[vote["message"]] = weight * 100
|
||||||
|
|
||||||
|
|
||||||
labels = list(options.keys())
|
labels = list(options.keys())
|
||||||
|
Loading…
Reference in New Issue
Block a user