From 4861ffbd7e01f012ac9073c68106bb183ca75fd1 Mon Sep 17 00:00:00 2001 From: David Lynch Date: Tue, 29 Oct 2019 08:17:01 -0500 Subject: [PATCH] Fiction.live can have votes for absent choices Fixes #28. --- sites/fictionlive.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sites/fictionlive.py b/sites/fictionlive.py index c936dd8..c671096 100644 --- a/sites/fictionlive.py +++ b/sites/fictionlive.py @@ -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('