-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathsubmit_ballots_step.py
More file actions
39 lines (30 loc) · 1.3 KB
/
submit_ballots_step.py
File metadata and controls
39 lines (30 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from typing import List
#import click
from print_utils import Echo
from electionguard.data_store import DataStore
from electionguard.ballot_box import BallotBox
from electionguard.ballot import CiphertextBallot
from .cli_step_base import CliStepBase
from ..cli_models import BuildElectionResults, SubmitResults
class SubmitBallotsStep(CliStepBase):
"""Responsible for submitting ballots."""
def submit(
self,
build_election_results: BuildElectionResults,
cast_ballots: List[CiphertextBallot],
spoil_ballots: List[CiphertextBallot],
) -> SubmitResults:
self.print_header("Submitting Ballots")
internal_manifest = build_election_results.internal_manifest
context = build_election_results.context
ballot_store: DataStore = DataStore()
ballot_box = BallotBox(internal_manifest, context, ballot_store)
for ballot in cast_ballots:
ballot_box.cast(ballot)
#click.echo(f"Cast Ballot Id: {ballot.object_id}")
Echo(f"Cast Ballot Id: {ballot.object_id}")
for ballot in spoil_ballots:
ballot_box.spoil(ballot)
#click.echo(f"Spoilt Ballot Id: {ballot.object_id}")
Echo(f"Spoilt Ballot Id: {ballot.object_id}")
return SubmitResults(ballot_store.all())