From 27a6dcd300b54d15f1c9f941611232415e3703e5 Mon Sep 17 00:00:00 2001 From: Umayanga Date: Sun, 17 Nov 2019 04:11:39 +0530 Subject: [PATCH 1/4] PRE 34 letter template upgrade --- .../TallySheetVersion_PRE_34_AI.py | 3 +- .../TallySheetVersion_PRE_34_ED.py | 4 +- .../TallySheetVersion_PRE_34_PD.py | 16 +- templates/PRE_34_ALL_ISLAND_RESULTS.html | 253 ++++++++++++++++++ 4 files changed, 273 insertions(+), 3 deletions(-) create mode 100644 templates/PRE_34_ALL_ISLAND_RESULTS.html diff --git a/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_AI.py b/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_AI.py index 29a495bd..916380fe 100644 --- a/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_AI.py +++ b/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_AI.py @@ -71,6 +71,7 @@ def html_letter(self): stamp = self.stamp content = { + "resultTitle": "ALL ISLAND RESULT", "election": { "electionName": self.submission.election.get_official_name(), }, @@ -100,7 +101,7 @@ def html_letter(self): content["logo"] = convert_image_to_data_uri("static/Emblem_of_Sri_Lanka.png") html = render_template( - 'PRE-34-AI-LETTER.html', + 'PRE_34_ALL_ISLAND_RESULTS.html', content=content ) diff --git a/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_ED.py b/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_ED.py index 9a3bfd87..0f7ef72d 100644 --- a/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_ED.py +++ b/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_ED.py @@ -70,7 +70,9 @@ def content(self): def html_letter(self): stamp = self.stamp + electoralDistrict = self.submission.area content = { + "resultTitle": "Results of Electoral District %s" % electoralDistrict.areaName, "election": { "electionName": self.submission.election.get_official_name() }, @@ -98,7 +100,7 @@ def html_letter(self): content["logo"] = convert_image_to_data_uri("static/Emblem_of_Sri_Lanka.png") html = render_template( - 'PRE-34-ED-LETTER.html', + 'PRE_34_ALL_ISLAND_RESULTS.html', content=content ) diff --git a/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_PD.py b/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_PD.py index e611f657..5f0e6950 100644 --- a/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_PD.py +++ b/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_PD.py @@ -73,8 +73,11 @@ def html_letter(self): stamp = self.stamp total_registered_voters = get_polling_division_total_registered_voters(tallySheetVersion=self) + electoral_district = Area.get_associated_areas(self.submission.area, AreaTypeEnum.ElectoralDistrict)[0] + polling_division = self.submission.area content = { + "resultTitle": "Results of PD", "election": { "electionName": self.submission.election.get_official_name(), "isPostal": self.submission.election.voteType == VoteTypeEnum.Postal @@ -100,12 +103,23 @@ def html_letter(self): "pollingDivision": self.submission.area.areaName } + if self.submission.election.voteType == VoteTypeEnum.Postal: + content["tallySheetCode"] = "PRE/30/PV" + content["pollingDivision"] = "Postal" + content["resultTitle"] = "Results of Electoral District %s (Postal)" % electoral_district.areaName + else: + content["pollingDivision"] = self.submission.area.areaName + content["resultTitle"] = "Results of Electoral District %s - Polling Division %s" % ( + electoral_district.areaName, + polling_division.areaName + ) + content["data"], total_valid_vote_count = TallySheetVersion.create_candidate_preference_struct(self.content) content["logo"] = convert_image_to_data_uri("static/Emblem_of_Sri_Lanka.png") html = render_template( - 'PRE-34-PD-LETTER.html', + 'PRE_34_ALL_ISLAND_RESULTS.html', content=content ) diff --git a/templates/PRE_34_ALL_ISLAND_RESULTS.html b/templates/PRE_34_ALL_ISLAND_RESULTS.html new file mode 100644 index 00000000..5ae68bc1 --- /dev/null +++ b/templates/PRE_34_ALL_ISLAND_RESULTS.html @@ -0,0 +1,253 @@ +{% extends 'base.html' %} + +{% block container %} +{% for pageNumber in [1,2,3,4] %} + +
+ + + + + + + + + + + +
OFFICIAL RESULTS + DEPARTMENT OF ELECTIONS + + {{content.election.electionName}} + + {{content.resultTitle}} + VOTES RECEIVED BY EACH CANDIDATE +
+ +
+ + + + + + + + + + + + {% for row in content.data %} + + + + + + + + + {% endfor %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Name of the CandidateVote CountSecond Preference CountThird Preference CountGrand Total
{{loop.index}}{{row.name}}{{row.firstPreferenceCount}}{{row.secondPreferenceCount}}{{row.thirdPreferenceCount}} {{ row.total }}
Total Valid Votes + {{content.validVoteCounts[0]}} + + {{content.validVoteCounts[1]}} +
Rejected Votes + {{content.rejectedVoteCounts[0]}} + + {{content.rejectedVoteCounts[1]}} +
Total Polled + {{content.totalVoteCounts[0]}} + + {{content.totalVoteCounts[1]}} +
Registered No. of Electors{{content.registeredVoters[0]}}
Time{{content.time}}
Date{{content.date}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% if pageNumber in [1,2,3,4] %} + + {% endif %} + {% if pageNumber in [1,2] %} + + {% endif %} + {% if pageNumber in [1,3] %} + + {% endif %} + +
+ ....................................
+ MAHINDA DESHAPRIYA
+ Chairman
+ Election Commission +
+ ....................................
+ N. J. ABEYESEKERE
+ Member
+ Election Commission +
+ ....................................
+ S. RATNAJEEVAN H. HOOLE
+ Member
+ Election Commission +
+ Election Secretariat, Sarana Mawatha, Rajagiriya. + +
+{% endfor %} +{% endblock %} From 75ed909e11c3aa378e7b3aecdb4eaf26b0896060 Mon Sep 17 00:00:00 2001 From: Umayanga Date: Sun, 17 Nov 2019 04:13:41 +0530 Subject: [PATCH 2/4] code name fix --- .../TallySheetVersion/TallySheetVersion_PRE_34_PD.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_PD.py b/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_PD.py index 5f0e6950..c5b46275 100644 --- a/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_PD.py +++ b/orm/entities/SubmissionVersion/TallySheetVersion/TallySheetVersion_PRE_34_PD.py @@ -104,7 +104,7 @@ def html_letter(self): } if self.submission.election.voteType == VoteTypeEnum.Postal: - content["tallySheetCode"] = "PRE/30/PV" + content["tallySheetCode"] = "PRE/34/PV" content["pollingDivision"] = "Postal" content["resultTitle"] = "Results of Electoral District %s (Postal)" % electoral_district.areaName else: From a93bb1b09b4aac3677a3ec0f9bc9b133311037a6 Mon Sep 17 00:00:00 2001 From: Umayanga Date: Sun, 17 Nov 2019 04:31:10 +0530 Subject: [PATCH 3/4] add page break --- templates/PRE_34_ALL_ISLAND_RESULTS.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/PRE_34_ALL_ISLAND_RESULTS.html b/templates/PRE_34_ALL_ISLAND_RESULTS.html index 5ae68bc1..45f906b4 100644 --- a/templates/PRE_34_ALL_ISLAND_RESULTS.html +++ b/templates/PRE_34_ALL_ISLAND_RESULTS.html @@ -249,5 +249,7 @@ Election Secretariat, Sarana Mawatha, Rajagiriya. +

+ {% endfor %} {% endblock %} From c548aa365a71ecf957403c460d1f8857a19f9575 Mon Sep 17 00:00:00 2001 From: Umayanga Date: Sun, 17 Nov 2019 04:36:17 +0530 Subject: [PATCH 4/4] page break to All Island PRE 30 --- templates/PRE_ALL_ISLAND_RESULTS.html | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/PRE_ALL_ISLAND_RESULTS.html b/templates/PRE_ALL_ISLAND_RESULTS.html index ece9ae4c..449d435f 100644 --- a/templates/PRE_ALL_ISLAND_RESULTS.html +++ b/templates/PRE_ALL_ISLAND_RESULTS.html @@ -241,5 +241,6 @@ Election Secretariat, Sarana Mawatha, Rajagiriya. +

{% endfor %} {% endblock %}