From 0fd1015f8bde3dcd11b1540a69ec62406ea9f85d Mon Sep 17 00:00:00 2001 From: Michael Pivato Date: Thu, 24 Jan 2019 16:17:23 +1030 Subject: [PATCH] Fix commander decision making --- DecisionSystem/CentralisedDecision/commander.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DecisionSystem/CentralisedDecision/commander.py b/DecisionSystem/CentralisedDecision/commander.py index 3e55969..7ecf669 100644 --- a/DecisionSystem/CentralisedDecision/commander.py +++ b/DecisionSystem/CentralisedDecision/commander.py @@ -29,7 +29,8 @@ class Commander: # Should change this to follow strategy pattern, for different implementations of # making a decision on the votes. print("Making a decision") - votes = self._votes + votes = self._votes.values() + print(type(votes)) dif_votes = {} for vote in votes: @@ -82,12 +83,13 @@ class Commander: print("Received a vote!") # Voter is sending in their vote. print(messageD.data["vote"]) + print("From: ", messageD.sender) if self._taking_votes: # Commander must have requested their taking votes, and the timeout # has not occurred. # Only add vote to list if the client has not already voted. if messageD.sender not in self._votes: - self._votes[messageD.sender] = messageD.data["vote"] + self._votes[messageD.sender] = int(messageD.data["vote"]) elif messageD.type == "disconnected": print("Voter disconnected :(")