Skip to content

Commit

Permalink
Add party abbreviations to candidates.
Browse files Browse the repository at this point in the history
Fixes BallotLab TrustTheVote-Project#83.
  • Loading branch information
ion-oset committed Aug 23, 2022
1 parent 55b5b38 commit a262592
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/electos/ballotmaker/scripts/ballot-lab-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,15 @@ def candidate_name(candidate: Candidate):


def candidate_party(candidate: Candidate, index):
"""Get the name of the party of a candidate as it appears on a ballot."""
"""Get the name and abbreviation of the party of a candidate as it appears on a ballot."""
party = index.by_id(candidate.party_id)
name = text_content(party.name) if party else ""
return name
abbreviation = text_content(party.abbreviation) if party and party.abbreviation else ""
result = {
"name": name,
"abbreviation": abbreviation,
}
return result


def candidate_contest_offices(contest: CandidateContest, index):
Expand Down

0 comments on commit a262592

Please sign in to comment.