Added camera enabling and disabling

This commit is contained in:
2026-06-04 16:32:30 +02:00
parent 988cb53de1
commit b71a685c58
12 changed files with 11539 additions and 168 deletions
+10 -6
View File
@@ -42,19 +42,22 @@ class Tournament:
return league_data
@staticmethod
def create_draft(enabled_players, tournament_type='20_targets', league_tournament_number=None):
"""Create draft groups of 6 players and organize rounds"""
def create_draft(enabled_players, tournament_type='20_targets', league_tournament_number=None, active_slots=None):
"""Create draft groups organized by shooting positions and organize rounds"""
if len(enabled_players) < 1:
return None
slots = sorted(active_slots) if active_slots else list(range(1, NUM_CAMERAS + 1))
positions = len(slots)
# Shuffle players for random grouping
players_copy = enabled_players.copy()
random.shuffle(players_copy)
# Create groups of up to 6
# Create groups of up to positions
groups = []
for i in range(0, len(players_copy), NUM_CAMERAS):
group = players_copy[i:i + NUM_CAMERAS]
for i in range(0, len(players_copy), positions):
group = players_copy[i:i + positions]
groups.append(group)
# Create rounds
@@ -72,7 +75,8 @@ class Tournament:
'total_players': len(enabled_players),
'total_rounds': len(rounds),
'current_round': 1,
'tournament_type': tournament_type
'tournament_type': tournament_type,
'active_slots': slots
}
if league_tournament_number: