Added camera enabling and disabling
This commit is contained in:
+10
-6
@@ -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:
|
||||
|
||||
+2
-1
@@ -34,7 +34,8 @@ DEFAULT_SETTINGS = {
|
||||
'display_options': {
|
||||
'show_titles': True,
|
||||
'title_size': 1.1
|
||||
}
|
||||
},
|
||||
'disabled_cameras': []
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user