Skip to content

Commit

Permalink
Merge pull request #387 from dinukadesilva/customizations-in-all-isla…
Browse files Browse the repository at this point in the history
…nd-ed-report

Fix the percentage calculations in all PRE-30-ED, AI-ED and AI
  • Loading branch information
dinukadesilva authored Nov 21, 2019
2 parents 814e17d + 729edff commit da039ea
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 da039ea

Please sign in to comment.