Player rates¶
- class sol.models.rate.Rate(**kwargs)¶
The Glicko rating of a player.
- classmethod check_insert(session: Session, fields: dict[str, Any], user_id: int | None) None¶
Perform any check before an new instance is inserted.
- Parameters:
session -- the SA session
fields -- a dictionary with the fields values
user_id -- either
None, to mean "admin", or the ID of the user performing the operation
- caption(html=None, localized=True)¶
A description of the rate.
- check_delete(user_id: int | None) None¶
Perform any check before deleting the instance.
- Parameters:
user_id -- either
None, to mean "admin", or the ID of the user performing the operation
- check_update(fields: dict[str, Any], user_id: int | None) None¶
Perform any check before updating the instance.
- Parameters:
fields -- a mapping containing
fieldname -> valueassociationsuser_id -- either
None, to mean "admin", or the ID of the user performing the operation
This implementation does nothing, but subclasses can override it at will, either to adapt incoming values or to check their validity, raising an exception if something is wrong.
- serialize(serializer: Serializer) SerializedRate¶
Reduce a single rate to a simple dictionary.
- Parameters:
serializer -- a
Serializerinstance- Return type:
dict
- Returns:
a plain dictionary containing a flatified view of this rate
- update(data, *, missing_only=False)¶
Update entity with given data.
- Parameters:
data -- a mapping kind of container
missing_only -- a boolean flag,
Falseby default
- 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
Truethen only the fields that are currently empty (that is, their value is eitherNoneor an empty string) are updated. Note that in this case an exception is made forboolfields: since in SoL they always have a value (i.e. they are never missing), they are always updated.
- date: Mapped[dtdate]¶
Rating date.
- deviation: Mapped[int]¶
The value of Glicko deviation.
- idrate: Mapped[int]¶
Primary key.
- idrating: Mapped[int]¶
Related rating's ID.
- rate: Mapped[int]¶
The value of Glicko rating.