election_day.utils.election.candidates
Classes
Functions
|
Returns the aggregated candidates results as list. |
|
" Get the candidates as JSON. Used to for the candidates bar chart. |
Returns the candidates results by entity. |
Module Contents
- election_day.utils.election.candidates.get_candidates_results(election: onegov.election_day.models.Election, session: sqlalchemy.orm.Session, entities: Collection[str] | None = None) Query[CandidateResultRow] [source]
Returns the aggregated candidates results as list.
Also includes percentages of votes for majorz elections. Be aware that this may contain rounding errors.
- election_day.utils.election.candidates.get_candidates_data(election: onegov.election_day.models.Election, limit: int | None = None, lists: Collection[str] | None = None, elected: bool | None = None, sort_by_lists: bool = False, entities: Collection[str] | None = None) onegov.core.types.JSONObject_ro [source]
“ Get the candidates as JSON. Used to for the candidates bar chart.
Allows to optionally
return only the first
limit
results.return only results for candidates within the given list names (proporz) or party names (majorz).
return only elected candidates. If not specified, only elected candidates are returned for proporz elections, all for majorz elections.
- election_day.utils.election.candidates.get_candidates_results_by_entity(election: onegov.election_day.models.Election, sort_by_votes: bool = False) tuple[list[CandidateRow], list[tuple[str, list[ResultRow]]]] [source]
Returns the candidates results by entity.
Allows to optionally order by the number of total votes instead of the candidate names.