oops
This commit is contained in:
@@ -113,13 +113,16 @@ class Game(db.Model):
|
||||
is_active = db.Column(db.Boolean, default=False) # Only one game active at a time
|
||||
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
|
||||
|
||||
# Relationships
|
||||
teams = db.relationship('Team', back_populates='game', cascade='all, delete-orphan')
|
||||
teams = db.relationship('Team', back_populates='game', cascade='all, delete-orphan',
|
||||
foreign_keys='Team.game_id')
|
||||
game_questions = db.relationship('GameQuestion', back_populates='game',
|
||||
cascade='all, delete-orphan',
|
||||
order_by='GameQuestion.order')
|
||||
scores = db.relationship('Score', back_populates='game', cascade='all, delete-orphan')
|
||||
current_turn_team = db.relationship('Team', foreign_keys=[current_turn_team_id], post_update=True)
|
||||
|
||||
@classmethod
|
||||
def get_active(cls):
|
||||
@@ -141,7 +144,9 @@ class Game(db.Model):
|
||||
'is_active': self.is_active,
|
||||
'current_question_index': self.current_question_index,
|
||||
'total_questions': len(self.game_questions),
|
||||
'is_template': self.is_template
|
||||
'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
|
||||
}
|
||||
|
||||
if include_questions:
|
||||
|
||||
Reference in New Issue
Block a user