-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #372 from dinukadesilva/postal-voters-pd-patch
Making a patch to correct the registered voters in polling division r…
- Loading branch information
Showing
3 changed files
with
198 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
189 changes: 189 additions & 0 deletions
189
orm/entities/SubmissionVersion/TallySheetVersion/fake_polling_division_voters_map.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
# TODO remove this | ||
|
||
from orm.enums import VoteTypeEnum, AreaTypeEnum | ||
|
||
polling_division_postal_voters_count = { | ||
"3": 480, | ||
"140": 981, | ||
"358": 1061, | ||
"454": 1401, | ||
"551": 478, | ||
"614": 761, | ||
"698": 927, | ||
"803": 1800, | ||
"1005": 1015, | ||
"1112": 4495, | ||
"1387": 4347, | ||
"1589": 7254, | ||
"1872": 3255, | ||
"2067": 4147, | ||
"2330": 1518, | ||
"2508": 1307, | ||
"2691": 775, | ||
"2858": 2548, | ||
"3082": 3876, | ||
"3253": 6620, | ||
"3445": 5311, | ||
"3644": 5926, | ||
"3853": 5932, | ||
"4079": 2493, | ||
"4274": 4706, | ||
"4498": 4962, | ||
"4678": 2847, | ||
"4856": 1311, | ||
"5003": 3070, | ||
"5158": 5139, | ||
"5338": 5210, | ||
"5496": 3413, | ||
"5622": 5761, | ||
"5767": 5061, | ||
"5923": 2660, | ||
"6077": 4903, | ||
"6269": 4164, | ||
"6377": 7964, | ||
"6639": 4150, | ||
"6779": 3712, | ||
"6894": 2855, | ||
"6986": 5106, | ||
"7125": 3716, | ||
"7241": 3692, | ||
"7368": 1616, | ||
"7433": 5554, | ||
"7570": 4727, | ||
"7707": 4559, | ||
"7870": 4121, | ||
"8023": 7636, | ||
"8251": 3985, | ||
"8400": 4644, | ||
"8534": 5029, | ||
"8707": 6502, | ||
"9244": 2879, | ||
"9413": 4692, | ||
"9569": 4051, | ||
"9726": 2218, | ||
"9833": 3822, | ||
"9975": 2682, | ||
"10106": 4570, | ||
"10261": 4408, | ||
"10451": 4309, | ||
"10627": 4265, | ||
"10772": 3747, | ||
"10913": 4870, | ||
"11076": 3154, | ||
"11238": 3095, | ||
"11374": 4246, | ||
"11513": 4209, | ||
"11651": 4825, | ||
"11786": 3446, | ||
"11920": 5010, | ||
"12055": 3408, | ||
"12200": 5076, | ||
"12381": 3931, | ||
"12539": 4918, | ||
"12756": 5410, | ||
"13062": 700, | ||
"13160": 2100, | ||
"13278": 1400, | ||
"13398": 2100, | ||
"13527": 2100, | ||
"13656": 2100, | ||
"13766": 1844, | ||
"13862": 2036, | ||
"13969": 2827, | ||
"14078": 1696, | ||
"14168": 2868, | ||
"14378": 4009, | ||
"14540": 4140, | ||
"14837": 2845, | ||
"15118": 2309, | ||
"15366": 6513, | ||
"15766": 2700, | ||
"16006": 14564, | ||
"16379": 2306, | ||
"16572": 2215, | ||
"16727": 5175, | ||
"17096": 6415, | ||
"17292": 3900, | ||
"17508": 3833, | ||
"17736": 8412, | ||
"17905": 6953, | ||
"18055": 9061, | ||
"18224": 6135, | ||
"18385": 5405, | ||
"18503": 3951, | ||
"18627": 3111, | ||
"18772": 3008, | ||
"18931": 5265, | ||
"19095": 5165, | ||
"19247": 4951, | ||
"19367": 5149, | ||
"19499": 5396, | ||
"19649": 3994, | ||
"19762": 2042, | ||
"19939": 5619, | ||
"20134": 2634, | ||
"20312": 1881, | ||
"20452": 1577, | ||
"20612": 8624, | ||
"20798": 7467, | ||
"20973": 7841, | ||
"21159": 7271, | ||
"21365": 7968, | ||
"21615": 4474, | ||
"21755": 5456, | ||
"21935": 4990, | ||
"22100": 4624, | ||
"22254": 7622, | ||
"22541": 5989, | ||
"22702": 3264, | ||
"22805": 2989, | ||
"22935": 4125, | ||
"23024": 3948, | ||
"23146": 3630, | ||
"23254": 4373, | ||
"23383": 4723, | ||
"23520": 3639, | ||
"23645": 7435, | ||
"23851": 7783, | ||
"24091": 7112, | ||
"24384": 3798, | ||
"24534": 4790, | ||
"24723": 2269, | ||
"24860": 4768, | ||
"25056": 3820, | ||
"25221": 2690, | ||
"25380": 2046, | ||
"25487": 5534, | ||
"25702": 4343, | ||
"25867": 3741, | ||
"25994": 4540, | ||
"26127": 4223, | ||
"26239": 4733, | ||
"26393": 3079, | ||
"26504": 2584, | ||
"26647": 2965, | ||
"26788": 2361 | ||
} | ||
|
||
|
||
def get_polling_division_total_registered_voters(tallySheetVersion): | ||
election = tallySheetVersion.submission.election | ||
polling_division_id = tallySheetVersion.submission.areaId | ||
total_registered_voters = 0 | ||
|
||
if election.voteType == VoteTypeEnum.Postal: | ||
electoral_district = tallySheetVersion.submission.area | ||
postal_counting_centres = electoral_district.get_associated_areas( | ||
areaType=AreaTypeEnum.CountingCentre, | ||
electionId=election.electionId | ||
) | ||
for postal_counting_centre in postal_counting_centres: | ||
total_registered_voters = total_registered_voters + postal_counting_centre._registeredVotersCount | ||
else: | ||
total_registered_voters = tallySheetVersion.submission.area.registeredVotersCount | ||
|
||
if str(polling_division_id) in polling_division_postal_voters_count: | ||
total_registered_postal_voters = polling_division_postal_voters_count[str(polling_division_id)] | ||
total_registered_voters = total_registered_voters - total_registered_postal_voters | ||
|
||
return total_registered_voters |