Problem: Hardcoded reference to the VOTE_TYPE in Election base class

Solution: Pointed the reference to the class variable
This commit is contained in:
z-bowen 2018-09-04 17:23:24 +02:00
parent 30a5b9374d
commit 7d756bf1a9

View File

@ -162,7 +162,7 @@ class Election(Transaction):
def count_votes(cls, election_pk, transactions, getter=getattr): def count_votes(cls, election_pk, transactions, getter=getattr):
votes = 0 votes = 0
for txn in transactions: for txn in transactions:
if getter(txn, 'operation') == 'VOTE': if getter(txn, 'operation') == cls.VOTE_TYPE:
for output in getter(txn, 'outputs'): for output in getter(txn, 'outputs'):
# NOTE: We enforce that a valid vote to election id will have only # NOTE: We enforce that a valid vote to election id will have only
# election_pk in the output public keys, including any other public key # election_pk in the output public keys, including any other public key