diff --git a/bigchaindb/backend/localmongodb/query.py b/bigchaindb/backend/localmongodb/query.py index aa80909e..992eaf8a 100644 --- a/bigchaindb/backend/localmongodb/query.py +++ b/bigchaindb/backend/localmongodb/query.py @@ -300,11 +300,11 @@ def get_validator_set(conn, height=None): @register_query(LocalMongoDBConnection) -def get_election_result_by_id(conn, election_id, table): +def get_election_result_by_id(conn, election_id): query = {'election_id': election_id} cursor = conn.run( - conn.collection(table) + conn.collection('validators') .find(query, projection={'_id': False}) ) diff --git a/bigchaindb/backend/query.py b/bigchaindb/backend/query.py index 54ff8900..3bf46c84 100644 --- a/bigchaindb/backend/query.py +++ b/bigchaindb/backend/query.py @@ -361,7 +361,7 @@ def get_validator_set(conn, height): @singledispatch -def get_election_result_by_id(conn, election_id, table): +def get_election_result_by_id(conn, election_id): """Return a validator set change with the specified election_id """ diff --git a/bigchaindb/common/election.py b/bigchaindb/common/election.py index 7c07fe8b..6388019b 100644 --- a/bigchaindb/common/election.py +++ b/bigchaindb/common/election.py @@ -23,8 +23,6 @@ class Election(Transaction): # NOTE: this transaction class extends create so the operation inheritance is achieved # by setting an ELECTION_TYPE and renaming CREATE = ELECTION_TYPE and ALLOWED_OPERATIONS = (ELECTION_TYPE,) ELECTION_TYPE = None - # the name of the mongodb table managed by the election - DB_TABLE = None # the model for votes issued by the election VOTE_TYPE = None # Election Statuses: @@ -221,7 +219,7 @@ class Election(Transaction): return self.ONGOING def get_election_result(self, election_id, bigchain): - result = bigchain.get_election_result_by_id(election_id, self.DB_TABLE) + result = bigchain.get_election_result_by_id(election_id) return result @classmethod diff --git a/bigchaindb/lib.py b/bigchaindb/lib.py index bee2f123..f50b0300 100644 --- a/bigchaindb/lib.py +++ b/bigchaindb/lib.py @@ -429,8 +429,8 @@ class BigchainDB(object): validators = result['validators'] return validators - def get_result_by_election_id(self, election_id, table): - result = backend.query.get_election_result_by_id(self.connection, election_id, table) + def get_election_result_by_id(self, election_id): + result = backend.query.get_election_result_by_id(self.connection, election_id) return result def store_pre_commit_state(self, state): diff --git a/bigchaindb/upsert_validator/validator_election.py b/bigchaindb/upsert_validator/validator_election.py index 3cc4fc26..998ca028 100644 --- a/bigchaindb/upsert_validator/validator_election.py +++ b/bigchaindb/upsert_validator/validator_election.py @@ -17,7 +17,6 @@ class ValidatorElection(Election): # by renaming CREATE to VALIDATOR_ELECTION CREATE = ELECTION_TYPE ALLOWED_OPERATIONS = (ELECTION_TYPE,) - DB_TABLE = 'validators' VOTE_TYPE = ValidatorElectionVote def validate(self, bigchain, current_transactions=[]):