sol.models.championship -- Championships

class sol.models.championship.Championship(**kwargs)

A series of tournaments organized by the same club.

caption(html=None, localized=True)

Return a possibly HTML-decorated caption of the entity.

Parameters:
  • html -- either None (the default) or a boolean value

  • localized -- a boolean value, True by default

Return type:

str

If html is None or True then the result may be an HTML representation of the entity, otherwise it is plain text.

If localized is False then the localization is turned off.

classmethod check_insert(session: Session, fields: dict[str, Any], user_id: str | int) None

Check description validity

check_update(fields: dict[str, Any], user_id: str | int) None

Check description validity

ranking(limit=None, onlywomen=False)

Summarize the championship, collecting final prizes of the players.

Parameters:
  • limit (either None or a date instance) -- the earliest date to consider

  • onlywomen (a boolean) -- whether only women should be considered

Return type:

a tuple of two slots

For each tuple of players collect the earned prize in each tourney of the championship, or zero if the players did not participate to a given event.

limit and onlywomen are used by the general rankings, to consider only last year tourneys and to produce women ranking respectively.

Results in a tuple of two items, the first being a list of three slots tuples, respectively the date, the description and the guid of a tourney, the second a list of tuples, sorted by total prize: each tuple contains five items, a tuple of players, their total prize, a list of their prizes sorted by date of event, the number of prizes and finally either None or a list of skipped prizes.

serialize(serializer) SerializedChampionship

Reduce a single championship to a simple dictionary.

Parameters:

serializer -- a Serializer instance

Return type:

dict

Returns:

a plain dictionary containing a flatified view of this championship

closed: Mapped[bool]

Whether the championships is closed, and its ranking finalized.

club: Mapped[Club]

The club that organize this championship.

couplings: Mapped[str | None]

Kind of pairing method used to build next round, used as default value for the corresponding field when creating a new tourney.

description: Mapped[str]

Description of the championship.

idchampionship: Mapped[int]

Primary key.

idclub: Mapped[int]

Organizer club's ID.

idowner: Mapped[int | None]

ID of the user that is responsible for this record.

idprevious: Mapped[int | None]

Previous championship's ID.

idrating: Mapped[int | None]

Possible rating ID, used as default value for the corresponding field when creating a new tourney.

modified: Mapped[datetime]

Last update timestamp.

next: Mapped[Championship]

Next championship.

owner: Mapped[User]

The owner of this record, admin when None.

playersperteam: Mapped[int]

Number of players per team.

previous: Mapped[Championship]

Previous championship.

prizes: Mapped[str]

Kind of prize-giving.

This is used to determine which method will be used to assign final prizes. It may be:

asis

means that the final prize is a plain integer number, monotonically decreasing down to 1 starting from num-of-competitors: this is meant to give the chance of swapping competitors positions after tournament's final rounds, the final prize column won't even show up in the final ranking printout;

fixed

means the usual way, that is 18 points to the winner, 16 to the second, 14 to the third, 13 to the fourth, …, 1 point to the 16th, 0 points after that;

fixed40

similar to fixed, but applied to best fourty scores starting from 1000:

  1. 1000

  2. 900

  3. 800

  4. 750

  5. 700

  6. 650

  7. 600

  8. 550

  9. 500

  10. 450

  11. 400

  12. 375

  13. 350

  14. 325

  15. 300

  16. 275

  17. 250

  18. 225

  19. 200

  20. 175

  21. 150

  22. 140

  23. 130

  24. 120

  25. 110

  26. 100

  27. 90

  28. 80

  29. 70

  30. 60

  31. 50

  32. 40

  33. 35

  34. 30

  35. 25

  36. 20

  37. 15

  38. 10

  39. 5

  40. 1

millesimal

is the classic method, that distributes a multiple of 1000/num-of-competitors;

centesimal

assigns 100 to the first ranked competitor, 1 to the last, linear interpolation to the other competitors.

rating: Mapped[Rating]

The default rating used by this championship.

skipworstprizes: Mapped[int]

Number of worst results to skip in computing the ranking.

tourneys: Mapped[list[Tourney]]

Tourneys in this championship.

trainingboards: Mapped[int | None]

When specified, this is the number of boards that players must complete in a “Corona Carrom” tourney.