Add right/wrong marking with steal mechanism and question stats
Adds Correct/Wrong buttons to admin panel that track question answer stats across games and implement a steal system where the next team gets one chance to answer if the first team is wrong. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -79,6 +79,9 @@ class Question(db.Model):
|
||||
start_time = db.Column(db.Integer, nullable=True) # Start time in seconds
|
||||
end_time = db.Column(db.Integer, nullable=True) # End time in seconds
|
||||
|
||||
times_correct = db.Column(db.Integer, default=0, nullable=False)
|
||||
times_incorrect = db.Column(db.Integer, default=0, nullable=False)
|
||||
|
||||
created_at = db.Column(db.DateTime, default=datetime.utcnow)
|
||||
created_by = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=True)
|
||||
|
||||
@@ -109,6 +112,8 @@ class Question(db.Model):
|
||||
'start_time': self.start_time,
|
||||
'end_time': self.end_time,
|
||||
'category': self.category,
|
||||
'times_correct': self.times_correct,
|
||||
'times_incorrect': self.times_incorrect,
|
||||
'created_at': self.created_at.isoformat() if self.created_at else None,
|
||||
'created_by': self.created_by,
|
||||
'creator_name': (self.creator.name or self.creator.preferred_username) if self.creator else None,
|
||||
@@ -157,6 +162,7 @@ class Game(db.Model):
|
||||
current_question_index = db.Column(db.Integer, default=0) # Track current question
|
||||
is_template = db.Column(db.Boolean, default=False) # Mark as reusable template
|
||||
current_turn_team_id = db.Column(db.Integer, db.ForeignKey('teams.id'), nullable=True) # Track whose turn it is
|
||||
steal_active = db.Column(db.Boolean, default=False) # True when a team got it wrong and next team can steal
|
||||
completed_at = db.Column(db.DateTime, nullable=True) # When game ended
|
||||
winners = db.Column(db.JSON, nullable=True) # [{"team_name": str, "score": int}, ...]
|
||||
|
||||
@@ -192,6 +198,7 @@ class Game(db.Model):
|
||||
'is_template': self.is_template,
|
||||
'current_turn_team_id': self.current_turn_team_id,
|
||||
'current_turn_team_name': self.current_turn_team.name if self.current_turn_team else None,
|
||||
'steal_active': self.steal_active,
|
||||
'completed_at': self.completed_at.isoformat() if self.completed_at else None,
|
||||
'winners': self.winners
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user