diff --git a/__pycache__/models.cpython-313.pyc b/__pycache__/models.cpython-313.pyc index 41bfe09..737a8e0 100644 Binary files a/__pycache__/models.cpython-313.pyc and b/__pycache__/models.cpython-313.pyc differ diff --git a/instance/team_tryouts.db b/instance/team_tryouts.db index a80efdc..b3442d8 100644 Binary files a/instance/team_tryouts.db and b/instance/team_tryouts.db differ diff --git a/models.py b/models.py index 24c3401..4f2a64a 100644 --- a/models.py +++ b/models.py @@ -28,7 +28,7 @@ ESPORT_GAMES = [ # Game-specific positions for tryouts GAME_POSITIONS = { 'League of Legends': ['Top Lane', 'Jungle', 'Mid Lane', 'ADC', 'Support'], - 'Valorant': ['Controller', 'Initiator', 'Duelist', 'Sentinel'], + 'Valorant': ['Controller', 'Initiator', 'Duelist', 'Sentinel', 'Flex'], 'Counter-Strike 2': ['AWPer', 'Entry Fragger', 'Lurker', 'In-Game Leader', 'Support'], 'Rainbow Six Siege': ['Entry', 'Support', 'Breacher', 'Anchor', 'Flex'], 'Overwatch 2': ['Tank', 'Damage', 'Support'], diff --git a/routes/__pycache__/matches.cpython-313.pyc b/routes/__pycache__/matches.cpython-313.pyc index e12dd0f..f22592f 100644 Binary files a/routes/__pycache__/matches.cpython-313.pyc and b/routes/__pycache__/matches.cpython-313.pyc differ diff --git a/routes/matches.py b/routes/matches.py index 407de22..3817c0a 100644 --- a/routes/matches.py +++ b/routes/matches.py @@ -292,7 +292,9 @@ def create_match(tryout_id): return redirect(url_for('tryouts.view_tryout', tryout_id=tryout_id)) teams = Team.query.filter_by(tryout_id=tryout_id).all() - all_players = User.query.filter_by(role='player').order_by(User.full_name).all() + registrations = TryoutRegistration.query.filter_by(tryout_id=tryout_id).all() + all_players = [User.query.get(r.player_id) for r in registrations if User.query.get(r.player_id)] + all_players = sorted([p for p in all_players if p], key=lambda x: x.full_name) if request.method == 'POST': title = request.form.get('title') @@ -353,13 +355,15 @@ def create_match(tryout_id): # Handle player vs player matches elif match_type == 'player_vs_player': - team1_player_ids = request.form.getlist('team1_player_ids') - team2_player_ids = request.form.getlist('team2_player_ids') - for pid in team1_player_ids: - participant = MatchParticipant(match_id=match.id, player_id=int(pid), team_side=1) + team1_player_ids = request.form.get('team1_player_ids', '') + team2_player_ids = request.form.get('team2_player_ids', '') + team1_ids = [int(p) for p in team1_player_ids.split(',') if p] if team1_player_ids else [] + team2_ids = [int(p) for p in team2_player_ids.split(',') if p] if team2_player_ids else [] + for pid in team1_ids: + participant = MatchParticipant(match_id=match.id, player_id=pid, team_side=1) db.session.add(participant) - for pid in team2_player_ids: - participant = MatchParticipant(match_id=match.id, player_id=int(pid), team_side=2) + for pid in team2_ids: + participant = MatchParticipant(match_id=match.id, player_id=pid, team_side=2) db.session.add(participant) # Handle player scrim matches diff --git a/templates/pages/create_match.html b/templates/pages/create_match.html index f054de3..6bf2b72 100644 --- a/templates/pages/create_match.html +++ b/templates/pages/create_match.html @@ -41,7 +41,7 @@ {% if current_user.can_manage_teams() or current_user.can_schedule_matches() %}
Click time slots consecutively to set match duration. Available players will be auto-selected below.
+Click time slots consecutively to set match duration. Players available in all selected time blocks will be preselected.