sol.models.match
-- Matches¶
- class sol.models.match.Match(**kwargs)¶
A single match.
This table contains all the matches played in the various rounds of a tourney. A match may be between two different competitors or between a competitor and a placeholder (amicably referred to as "phantom"), when the number of competitors is odd.
A description of the match, made up with the description of each competitor.
- check_update(fields: dict[str, Any], user_id: str | int) None ¶
Check scores validity, and possibly create
Board
instances.
- computePartialScores()¶
Enrich played boards with partial scores.
- results()¶
Results of this match, comparing competitor' scores.
- Return type:
tuple
- Returns:
winner, loser, netscore
- serialize(serializer: Serializer, competitors: dict[int | None, int | None]) SerializedMatch ¶
Reduce a single match to a simple dictionary.
- Parameters:
serializer -- a
Serializer
instancecompetitors -- a mapping between competitor integer ID to its integer marker
- Return type:
dict
- Returns:
a plain dictionary containing a flatified view of this match
- board: Mapped[int]¶
The number of the carromboard this match is played on.
- breaker: Mapped[str | None]¶
Which competitor started the break.
- competitor1¶
First
competitor
- property competitor1FullName¶
Full name of the first
competitor
- property competitor1Opponents¶
List of competitors ID who played against the first competitor
- competitor2¶
Second
competitor
(may beNone
, the Phantom).
- property competitor2FullName¶
Full name of the second
competitor
- property competitor2Opponents¶
List of competitors ID who played against the second competitor
- property description¶
A description of the match, made up with the description of each competitor.
- final: Mapped[bool]¶
Whether the match is a normal one or a final.
- idcompetitor1: Mapped[int]¶
First
competitor
's ID.
- idcompetitor2: Mapped[int | None]¶
Second
competitor
's ID (possibly None).
- idmatch: Mapped[int]¶
Primary key.
- property isScored: bool¶
Tell whether the match has been compiled.
- partial_score1: int | None = None¶
The running score of the first
competitor
, while the match is still being played.
- partial_score2: int | None = None¶
The running score of the second
competitor
, while the match is still being played.
- score1: Mapped[int]¶
Score of the first
competitor
.
- score1_2: Mapped[int]¶
Score of the first
competitor
in the second game, when playing in best-of-three games mode.
- score1_3: Mapped[int]¶
Score of the first
competitor
in the third game, when playing in best-of-three games mode.
- score2: Mapped[int]¶
Score of the second
competitor
.
- score2_2: Mapped[int]¶
Score of the second
competitor
in the second game, when playing in best-of-three games mode.
- score2_3: Mapped[int]¶
Score of the second
competitor
in the third game, when playing in best-of-three mode.
- turn: Mapped[int]¶
Round number of the match.