diff --git a/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_ALL_ISLAND_RESULTS_BY_ELECTORAL_DISTRICTS.py b/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_ALL_ISLAND_RESULTS_BY_ELECTORAL_DISTRICTS.py index 83b1550c..e522a86b 100644 --- a/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_ALL_ISLAND_RESULTS_BY_ELECTORAL_DISTRICTS.py +++ b/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_ALL_ISLAND_RESULTS_BY_ELECTORAL_DISTRICTS.py @@ -7,7 +7,7 @@ from orm.entities.SubmissionVersion import TallySheetVersion from orm.entities.TallySheetVersionRow import TallySheetVersionRow_PRE_ALL_ISLAND_RESULTS_BY_ELECTORAL_DISTRICTS, \ TallySheetVersionRow_RejectedVoteCount -from util import to_comma_seperated_num, sqlalchemy_num_or_zero +from util import to_comma_seperated_num, sqlalchemy_num_or_zero, to_percentage from orm.enums import TallySheetCodeEnum, AreaTypeEnum from sqlalchemy import and_ @@ -267,6 +267,11 @@ def get_html_content_dict(self): content["rejectedVoteCounts"].append(to_comma_seperated_num(vote_count_result.rejectedVoteCount)) content["totalVoteCounts"].append(to_comma_seperated_num(vote_count_result.totalVoteCount)) + # Append the percentages. + content["validVoteCounts"].append(to_percentage(vote_count_result.validVoteCount * 100 / vote_count_result.totalVoteCount)) + content["rejectedVoteCounts"].append(to_percentage(vote_count_result.rejectedVoteCount * 100 / vote_count_result.totalVoteCount)) + content["totalVoteCounts"].append(to_percentage(100)) + number_of_electoral_districts = len(area_wise_vote_count_result) number_of_candidates = len(candidate_wise_vote_count_result) @@ -296,6 +301,9 @@ def get_html_content_dict(self): data_row.append(to_comma_seperated_num(candidate_wise_vote_count_result_item.validVoteCount)) + candidate_wise_vote_count_percentage = (candidate_wise_vote_count_result_item.validVoteCount/vote_count_result.validVoteCount) * 100 + data_row.append(to_percentage(candidate_wise_vote_count_percentage)) + content["data"].append(data_row) return content diff --git a/templates/PRE_ALL_ISLAND_RESULTS_BY_ELECTORAL_DISTRICTS.html b/templates/PRE_ALL_ISLAND_RESULTS_BY_ELECTORAL_DISTRICTS.html index d71440a0..942b830c 100644 --- a/templates/PRE_ALL_ISLAND_RESULTS_BY_ELECTORAL_DISTRICTS.html +++ b/templates/PRE_ALL_ISLAND_RESULTS_BY_ELECTORAL_DISTRICTS.html @@ -1,6 +1,36 @@ {% extends 'base.html' %} {% block container %} +
{{content.election.electionName}} @@ -16,13 +46,17 @@ - + # + Name of the Candidate (According to the order in the Ballot Paper) - + ELECTORAL DISTRICT {{ed_column_width}} - TOTAL + TOTAL + +
Percentage
+ TOTAL NUMBER OF VOTES IN WORDS @@ -33,6 +67,7 @@ {% for row in content.data %} + {{loop.index}} {% for cell in row %} {{cell}} {% endfor %} @@ -41,7 +76,11 @@ {% endfor %} - NO OF VALID VOTES + + + + + NO OF VALID VOTES {% for validVoteCount in content.validVoteCounts %} {{validVoteCount}} {% endfor %} @@ -49,7 +88,7 @@ - NO OF REJECTED VOTES + NO OF REJECTED VOTES {% for rejectedVoteCount in content.rejectedVoteCounts %} {{rejectedVoteCount}} {% endfor %} @@ -57,7 +96,7 @@ - TOTAL NO OF VOTES POLLED (INCLUDING REJECTED VOTES) + TOTAL NO OF VOTES POLLED (INCLUDING REJECTED VOTES) {% for totalVoteCount in content.totalVoteCounts %} {{totalVoteCount}} {% endfor %}