Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed tallying for single-question
  • Loading branch information
Ben Adida authored and Ben Adida committed Nov 5, 2009
1 parent 20c68ba commit 36413f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tally.py
Expand Up @@ -34,7 +34,7 @@
r_tables_xml = [base.file_in_dir(data_path, filenames.MEETING_THREE_OUT, 'Meeting Three Out') for data_path in DATA_PATHS]
r_tables_list = [data.parse_r_tables(r_tables) for r_tables in r_tables_xml]

print "ok now tallying\n\n"
# print "ok now tallying\n\n"

# the list of partitions, each of which is a list of the max number of answers each question allows
partition_map = election.partition_map_choices
Expand Down Expand Up @@ -79,7 +79,7 @@ def tally(output_stream):
%s
""" % (election.spec.id, len(r_tables[0].rows), RESULT))
""" % (election.spec.id, len(BALLOTS), RESULT))

if __name__ == '__main__':
tally(sys.stdout)
4 changes: 2 additions & 2 deletions tallydata.py
Expand Up @@ -70,7 +70,7 @@ def tally(cls, question, ballots):
bad_ballot = b
print "oy"

print candidate_tallies
# print candidate_tallies

if max(candidate_tallies) >= absolute_majority:
break
Expand All @@ -79,7 +79,7 @@ def tally(cls, question, ballots):
lowest_count = min([tally for tally in candidate_tallies if tally is not None])
lowest_count_index = candidate_tallies.index(lowest_count)
eliminated.append(lowest_count_index)
print "eliminating candidate %s with count %s" % (lowest_count_index, lowest_count)
#print "eliminating candidate %s with count %s" % (lowest_count_index, lowest_count)
for b in ballots:
b.go_next_choice(lowest_count_index)

Expand Down

0 comments on commit 36413f7

Please sign in to comment.