Challenge(id, user_from_id, user_to_id, date, status, winner_id)
Check if user can play this challenge
Assigns questions, and returns the number of assigned q
Return true if there are any challenges between the two users in the last day
returns a string with extra info for a string such as User 1 finished the challenge in $SECONDS seconds (or $MINUTES minutes and seconds) and scored X points)
Return all expired candidate challenges at given date.
This function assumes that seconds_took has been set. If the user didn’t submit the challenge, this will return False which might be incorrect. TODO: fix this to first check if user has submitted, and if not, verify with datetime.now - participant.start.
Check if the challenge has expired for the user
Check if the challenge has already started for the given user
Both players have played, save and score Notice the fact this is the only function where the scoring is affected
Set user’s results. If both users have played, also update self and activity.
Update user.start and set playing time to now This is called when one of the participants sees the challenge for the first time. After this call, challenge will be visible to him for 5 minutes TODO: check it hasn’t been already started in the past
Each game must extend Game
Return a list of active (runnable) challenges for a user
Return a list of status != L/A challenges, where played = False
Returns a list of formulas used by qotd
Challenge game modifiers
Return a list of played (scored TODO) challenges for a user
Extension of the userprofile, customized for challenge
Check if the target user is available.
Check if 1 challenge per day restriction apply
Check if the user has 30 points to challenge
Participant(id, user_id, start, seconds_took, played, responses, score)
For some reason, this is called twice. Needs investigantion Also, in django devele, on_delete=cascade will fix this hack
Displays a challenge, only if status = accepted This is play
Shows all challenges related to the current user
Set challenge as played for the other user. Only superuser can do this. Useful for debugging