sol.models.competitor -- Competitors

class sol.models.competitor.Competitor(**kwargs)

A single competitor in a game.

A competitor may be a single person or a team of up to four players, that participate to a given tourney. On each competitor this table keeps the points, the netscore and his bucholz, as well as the final prize. To disambiguate the ranking it maintains also a totscore, the total number of pocketed carrommen summing up competitor' scores in all played games.

caption(html=None, localized=True, player_caption=None, css_class=None, nationality=False, omit_nicknames=False)

A description of the competitor, made up with the name of each player.

getOpponentsPreceedingTurns(turn)

List of competitors ID who played against this competitor.

serialize(serializer: Serializer) SerializedCompetitor

Reduce a single competitor to a simple dictionary.

Parameters:

serializer -- a Serializer instance

Return type:

dict

Returns:

a plain dictionary containing a flatified view of this competitor

update(data, idowner, *, missing_only=False)

Update entity with given data.

Parameters:
  • data -- a mapping kind of container

  • missing_only -- a boolean flag, False by default

  • user_id -- either the string "admin" or the ID of the user performing the operation

Return type:

dict

Returns:

a mapping between field name and a tuple (oldvalue, newvalue), for each modified field

First call check_update() to assert the validity of incoming data, then update the instance fields.

If missing_only is True then only the fields that are currently empty (that is, their value is either None or an empty string) are updated. Note that in this case an exception is made for bool fields: since in SoL they always have a value (i.e. they are never missing), they are always updated.

bucholz: Mapped[int]

Weight of the opponents (sum of opponents' points and netscore).

property description

A description of the competitor, made up with the name of each player.

idcompetitor: Mapped[int]

Primary key.

idplayer1: Mapped[int]

First player's ID.

idplayer2: Mapped[int | None]

Second player's ID.

idplayer3: Mapped[int | None]

Third player's ID.

idplayer4: Mapped[int | None]

Fourth player's ID.

idtourney: Mapped[int]

Subscribed tourney's ID.

property nationality

Nationality of the first player

netscore: Mapped[int]

Net score (sum of carrommen difference in each match).

player1: Mapped[Player]

First player.

property player1FirstName

First name of the first player

property player1FullName

Full name of the first player

property player1LastName

Last name of the first player

property player1Nationality

Nationality of the first player

property player1Sex

Gender of the first player

player2: Mapped[Player | None]

Second player.

property player2FullName

Full name of the second player

property player2Nationality

Nationality of the second player

player3: Mapped[Player | None]

Third player.

property player3FullName

Full name of the third player

property player3Nationality

Nationality of the third player

player4: Mapped[Player | None]

Fourth player.

property player4FullName

Full name of the fourth player

property player4Nationality

Nationality of the fourth player

points: Mapped[int]

Points (number of wins * 2 + number of draws).

position: Mapped[int]

The relative position of this competitor, used to generate the first round in knockout tournaments, overriding their current rate.

prize: Mapped[Decimal]

Final prize.

property rank: int

The position of this competitor in the tourney's ranking.

property rate: int | None

Rate of this competitor, summing up all players rates

retired: Mapped[bool]

A competitor may stop playing in the middle of the tourney.

totscore: Mapped[int]

Total score (sum of carrommen in each match).