1
0
Fork 0
mirror of https://github.com/kemayo/leech synced 2025-12-29 11:42:20 +01:00

Fiction.live can have votes for absent choices

Fixes #28.
This commit is contained in:
David Lynch 2019-10-29 08:17:01 -05:00
parent dc10e4cf17
commit 4861ffbd7e

View file

@ -64,8 +64,10 @@ class FictionLive(Site):
if type(votechoices) == int:
votechoices = (votechoices,)
for choice in votechoices:
choice = segment['choices'][int(choice)]
votes[choice] = votes.get(choice, 0) + 1
if int(choice) in segment['choices']:
# sometimes someone has voted for a presumably-deleted choice
choice = segment['choices'][int(choice)]
votes[choice] = votes.get(choice, 0) + 1
choices = [(votes[v], v) for v in votes]
choices.sort(reverse=True)
html.append('<hr/><ul>')