From 5502f694d0988cc22e1bcd56f0b97d7b0a9509f3 Mon Sep 17 00:00:00 2001 From: Ben Adida <ben@adida.net> Date: Wed, 21 May 2014 22:57:52 -0700 Subject: [PATCH] more efficient traversal of voters --- helios/models.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/helios/models.py b/helios/models.py index d097b49..7fda728 100644 --- a/helios/models.py +++ b/helios/models.py @@ -371,9 +371,8 @@ class Election(HeliosModel): tally the election, assuming votes already verified """ tally = self.init_tally() - for voter in self.voter_set.all(): - if voter.vote: - tally.add_vote(voter.vote, verify_p=False) + for voter in self.voter_set.exclude(vote=None): + tally.add_vote(voter.vote, verify_p=False) self.encrypted_tally = tally self.save() -- GitLab