Challenge
The Challenge model represents regular mathematical challenges. Table name:challenge
Fields
Primary key, auto-incrementing
Challenge title (indexed)
Challenge description and instructions
Publication timestamp (indexed)
Optional file attachment URL
Educational key stage (indexed)
Timestamp of first correct answer
Scheduled release time (indexed, nullable)
Manual lock override flag
Hours until automatic lock (nullable)
Relationships
Properties
- Returns
Trueifis_manually_lockedis set - If
lock_after_hoursandrelease_atare set, returnsTrueif current time exceedsrelease_at + lock_after_hours - Otherwise returns
False
bool: Lock status
ChallengeAnswerBox
Represents individual answer inputs for multi-part challenges. Table name:challenge_answer_box
Fields
Primary key, auto-incrementing
Foreign key to
challenge.id (indexed)Display label (e.g., “Part A”, “Step 1”)
The correct answer value
Display order within challenge
Relationships
Indexes
- Composite index:
ix_challenge_answer_box_challenge_orderon (challenge_id,order)
Methods
- Attempts mathematical expression comparison using
compare_mathematical_expressionsutility - Falls back to case-insensitive string comparison if mathematical comparison fails
submitted_answer(str): User’s submitted answer
bool: True if correct, False otherwise
SummerChallenge
The SummerChallenge model represents time-limited summer competition challenges. Table name:summer_challenge
Fields
Primary key, auto-incrementing
Challenge title (indexed)
Challenge description and instructions
Publication timestamp
Challenge duration in hours
Optional file attachment URL
Educational key stage (indexed)
Manual lock override flag
Scheduled release time (indexed, nullable)
Relationships
Properties
- Returns
Trueifis_manually_lockedis set OR current time exceedsdate_posted + duration_hours
bool: Lock status
"manually_locked": Ifis_manually_lockedis True"time_expired": If current time exceedsdate_posted + duration_hoursNone: If challenge is not locked
SummerChallengeAnswerBox
Represents individual answer inputs for multi-part summer challenges. Table name:summer_challenge_answer_box
Fields
Primary key, auto-incrementing
Foreign key to
summer_challenge.id (indexed)Display label (e.g., “Part A”, “Question 1”)
The correct answer value
Display order within challenge
Relationships
Indexes
- Composite index:
ix_summer_answer_box_challenge_orderon (challenge_id,order)
Methods
- Attempts mathematical expression comparison using
compare_mathematical_expressionsutility - Falls back to case-insensitive string comparison if mathematical comparison fails
submitted_answer(str): User’s submitted answer
bool: True if correct, False otherwise