Skip to content

Commit

Permalink
Fix the percentage calculations in all PRE-30-ED, AI-ED and AI
Browse files Browse the repository at this point in the history
  • Loading branch information
dinukadesilva committed Nov 21, 2019
1 parent ba28c65 commit 729edff
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,12 @@ def html_letter(self):

content["validVoteCounts"] = [
to_comma_seperated_num(vote_count_result.validVoteCount),
to_percentage(vote_count_result.validVoteCount * 100 / self.submission.area.registeredVotersCount)
to_percentage(vote_count_result.validVoteCount * 100 / vote_count_result.totalVoteCount)
]

content["rejectedVoteCounts"] = [
to_comma_seperated_num(vote_count_result.rejectedVoteCount),
to_percentage(vote_count_result.rejectedVoteCount * 100 / self.submission.area.registeredVotersCount)
to_percentage(vote_count_result.rejectedVoteCount * 100 / vote_count_result.totalVoteCount)
]

content["totalVoteCounts"] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ def vote_count_result(self):

if registered_voters_count > 0:
vote_count_result["validVoteCountPercentage"] = (valid_vote_count_result.validVoteCount /
registered_voters_count) * 100
total_vote_count) * 100
vote_count_result["totalVoteCountPercentage"] = (total_vote_count / registered_voters_count) * 100

if rejected_vote_count_result.rejectedVoteCount is not None:
vote_count_result["rejectedVoteCountPercentage"] = (rejected_vote_count_result.rejectedVoteCount /
registered_voters_count) * 100
total_vote_count) * 100

return vote_count_result

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,9 @@ def get_html_content_dict(self):

# Append the percentages.
content["validVoteCounts"].append(
to_percentage(vote_count_result.validVoteCount * 100 / vote_count_result.registeredVotersCount))
to_percentage(vote_count_result.validVoteCount * 100 / vote_count_result.totalVoteCount))
content["rejectedVoteCounts"].append(
to_percentage(vote_count_result.rejectedVoteCount * 100 / vote_count_result.registeredVotersCount))
to_percentage(vote_count_result.rejectedVoteCount * 100 / vote_count_result.totalVoteCount))
content["totalVoteCounts"].append(
to_percentage(vote_count_result.totalVoteCount * 100 / vote_count_result.registeredVotersCount))

Expand Down

0 comments on commit 729edff

Please sign in to comment.