### Navigation

- index
- modules |
- next |
- previous |
- Dev's documentation »
- SoL modules »
- `sol.models` – SQLAlchemy modelization »
- Entities »

# `sol.models.tourney` – Tournaments

class `sol.models.tourney.``Tourney`(**kwargs)

  A single tournament.

  `allPlayers`()

    Generator that return all involved players.

  `assignPrizes`()

    Consolidate final points.

  `competitors`

    List of `competitors`.

  `computeRanking`(turn=None)

    Recompute competitors ranking.

    Parameters: | turn – if given, compute the ranking up to that turn
    Return type: | list
    Returns: | a list of tuples, each containing one of the competitors and a `Rank` instance, sorted on the second item in descending order

    Compute each competitor rank by examining the matches of this tourney, summing up each other’s current ranking position as the bucholz.

  `countdownstarted`

    Timestamp of the start of the clock countdown, milliseconds since Unix epoch.

  `couplings`

    Kind of pairing method used to build next round. It may be serial or dazed.

  `currentturn`

    The current round.

  `date`

    Event date.

  `delaytoppairing`

    Number of rounds for which pairing of top players should be postponed, if possible.

  `description`

    Event description.

  `duration`

    Duration in minutes of each round, used by the clock.

  `finalkind`

    Kind of finals. It may be simple or bestof3.

  `finals`

    The number of finals that will be played.

  `finalturns`

    Whether the tourney is in final rounds state.

  `idchampionship`

    Related `championship`‘s ID.

  `idowner`

    ID of the `user` that is responsible for this record.

  `idrating`

    Possible `rating` ID this tourney uses and updates.

  `idtourney`

    Primary key.

  `location`

    Event location.

  `makeFinalTurn`()

    Generate the final matches.

  `makeNextTurn`()

    Setup the next round.

    If there are no matches, build up the first round using a random coupler. Otherwise, using current ranking, create the next round pairing any given competitor with a not-yet-met other one that follows him in the ranking.

  `matches`

    List of `matches`, sorted by round and board.

  `owner`

    The `owner` of this record, admin when `None`.

  `phantomscore`

    The score assigned to a player in matches against the Phantom.

  `prealarm`

    Prealarm before the end of the round.

  `prized`

    Whether the tourney is closed, and final prizes updated.

  `rankedturn`

    The highest round considered in the ranking.

  `ranking`

    Competitors sorted by their rank.

    Return type: | sequence
    Returns: | sorted list of `competitors`

    Update the ranking if needed, that is when currentturn is higher than rankedturn.

  `replay`(date, newidowner=None)

    Clone this tourney, creating new one at given date.

    Of the original, only the competitors are copied. This is particularly useful for doubles (or team), so that the players get copied in the same order.

  `resetPrizes`()

    Reset assigned final points.

  `serialize`(serializer)

    Reduce a single tourney to a simple dictionary.

    Parameters: | serializer – a `Serializer` instance
    Return type: | dict
    Returns: | a plain dictionary containing a flatified view of this tourney

  `updateRanking`()

    Recompute and update competitors ranking.

### Navigation

- index
- modules |
- next |
- previous |
- Dev's documentation »
- SoL modules »
- `sol.models` – SQLAlchemy modelization »
- Entities »