Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions server/api/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ def ballot_vote_deltas(
reported = {choice.id: "0" for choice in contest.choices}

deltas = {}
total_audited_votes = 0
for choice in contest.choices:
reported_vote = (
0 if reported[choice.id] in ["o", "u"] else int(reported[choice.id])
Expand All @@ -535,6 +536,18 @@ def ballot_vote_deltas(
0 if audited[choice.id] in ["o", "u"] else int(audited[choice.id])
)
deltas[choice.id] = reported_vote - audited_vote
total_audited_votes += audited_vote

# If the reported CVR indicates an ES&S overvote and the audit confirms an overvote, record no
# discrepancy
reported_ess_overvote = "o" in reported.values()
audited_overvote = (
contest.votes_allowed is not None
and total_audited_votes > contest.votes_allowed
)
if reported_ess_overvote and audited_overvote:
for choice in contest.choices:
deltas[choice.id] = 0

if all(delta == 0 for delta in deltas.values()):
return None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
J1,0002,BATCH2,5,0002000175,"Round 1: 0.128937575131137250, 0.240487859312182291",AUDITED,Choice 1-2,Choice 1-2,,,Choice 2-2,Choice 2-2,,\r
J2,0001,BATCH1,1,0001013415,Round 1: 0.228946820159681463,AUDITED,"Choice 1-1, INVALID_WRITE_IN",Choice 1-1,,,"Choice 2-1, INVALID_WRITE_IN",Choice 2-1,,\r
J2,0001,BATCH1,3,0001013417,Round 1: 0.457121710197159606,AUDITED,Choice 1-1,Choice 1-1,,,Choice 2-1,Choice 2-1,,\r
J2,0001,BATCH2,3,0001000417,Round 1: 0.269793733438455805,AUDITED,"Choice 1-1, Choice 1-2",Overvote,Choice 1-1: -1; Choice 1-2: -1,,"Choice 2-1, Choice 2-3",Overvote,Choice 2-1: -1; Choice 2-3: -1,\r
J2,0001,BATCH2,3,0001000417,Round 1: 0.269793733438455805,AUDITED,"Choice 1-1, Choice 1-2",Overvote,,,"Choice 2-1, Choice 2-3",Overvote,,\r
J2,0002,BATCH1,3,0002003173,Round 1: 0.328294241227374952,AUDITED,Choice 1-2,Overvote,Choice 1-2: -1,1,Choice 2-2,Overvote,Choice 2-2: -1,1\r
J2,0002,BATCH2,1,0002000171,Round 1: 0.390715133294243377,AUDITED,Choice 1-1,Choice 1-1,,,Choice 2-3,Choice 2-3,,\r
J2,0002,BATCH2,2,0002000172,Round 1: 0.064290634474137509,AUDITED,Choice 1-1,Choice 1-1,,,Choice 2-3,Choice 2-3,,\r
Expand Down