components.UserScore

class components.UserScore

Bases: components.picklablebase.PicklableBase

The high score of a single user. Keeps track of their game stats. components.UserScore instances are subscriptable: For each date day, score[day] is a components.Score instance with the number of answers and correct answers given by the user on that day. To add values, add_to_score() should be the preferred method.

add_to_score(answers, correct, date=None)

Adds the given answers to the score of the given date.

Parameters
  • answers (int) – Number of given answers.

  • correct (int) – Number of correct answers.

  • date (Optional[date]) – Date of the score. Defaults to today.

Raises

ValueError – If more correct answers than answers are given.

Return type

None

property months_score: components.score.Score

The overall score, that the user achieved during the current month.

Return type

Score

property overall_score: components.score.Score

The overall score of the user.

Return type

Score

property todays_score: components.score.Score

Gives the score, that the user achieved today.

Return type

Score

property weeks_score: components.score.Score

The overall score, that the user achieved during the current week.

Return type

Score

property years_score: components.score.Score

The overall score, that the user achieved during the current year.

Return type

Score