Add category grouping in game queue and category slide transitions
Questions in the game queue are now grouped by category with per-group drag-and-drop constraints and category reorder buttons. During live games, a full-screen category slide appears for 3 seconds when transitioning between categories. Backend now includes previous_category and category_changed fields in question_changed events. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -106,18 +106,31 @@ def broadcast_question_change(game, socketio_instance):
|
||||
if not current_question:
|
||||
return
|
||||
|
||||
# Determine previous category for category slide transitions
|
||||
prev_category = None
|
||||
if game.current_question_index > 0:
|
||||
prev_gq = game.game_questions[game.current_question_index - 1]
|
||||
prev_category = prev_gq.question.category
|
||||
|
||||
current_category = current_question.category
|
||||
category_changed = current_category != prev_category
|
||||
|
||||
# Emit to contestant room (without answer)
|
||||
socketio_instance.emit('question_changed', {
|
||||
'question_index': game.current_question_index,
|
||||
'question': current_question.to_dict(include_answer=False),
|
||||
'total_questions': len(game.game_questions)
|
||||
'total_questions': len(game.game_questions),
|
||||
'previous_category': prev_category,
|
||||
'category_changed': category_changed
|
||||
}, room=f'game_{game.id}_contestant')
|
||||
|
||||
# Emit to admin room (with answer)
|
||||
socketio_instance.emit('question_with_answer', {
|
||||
'question_index': game.current_question_index,
|
||||
'question': current_question.to_dict(include_answer=True),
|
||||
'total_questions': len(game.game_questions)
|
||||
'total_questions': len(game.game_questions),
|
||||
'previous_category': prev_category,
|
||||
'category_changed': category_changed
|
||||
}, room=f'game_{game.id}_admin')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user