election_day.models.election_compound.mixins

Attributes

Elections

Classes

ResultRow

TotalRow

DerivedAttributesMixin

A simple mixin to add commonly used functions to election compounds

Module Contents

election_day.models.election_compound.mixins.Elections: TypeAlias = relationship[list[Election]] | list['Election'][source]
class election_day.models.election_compound.mixins.ResultRow[source]

Bases: NamedTuple

domain_segment: str[source]
domain_supersegment: str[source]
counted: bool[source]
turnout: float[source]
eligible_voters: int[source]
expats: int[source]
received_ballots: int[source]
accounted_ballots: int[source]
blank_ballots: int[source]
invalid_ballots: int[source]
accounted_votes: int[source]
class election_day.models.election_compound.mixins.TotalRow[source]

Bases: NamedTuple

turnout: float[source]
eligible_voters: int[source]
expats: int[source]
received_ballots: int[source]
accounted_ballots: int[source]
blank_ballots: int[source]
invalid_ballots: int[source]
accounted_votes: int[source]
class election_day.models.election_compound.mixins.DerivedAttributesMixin[source]

A simple mixin to add commonly used functions to election compounds and parts.

Requires an elections and session attribute.

property session: sqlalchemy.orm.Session[source]
property number_of_mandates: int[source]

The (total) number of mandates.

property allocated_mandates: int[source]

Number of already allocated mandates/elected candidates.

property completed: bool[source]

Returns True, if all elections are completed.

property counted: bool[source]

True if all elections have been counted.

property counted_entities: list[str | None][source]
property results: list[ResultRow][source]
property totals: TotalRow[source]