Bug fix
Ajout du statut remplaçant pour les joueurs Possibilité d'ajouter/enlever coach et manager des équipes les joueurs peuvent être associés à plusieurs équipes au lieu d'une seule
This commit is contained in:
@@ -6,7 +6,7 @@ users, tryouts, teams, evaluations, and player disponibilities.
|
||||
|
||||
from sqlalchemy import text
|
||||
from extensions import db, hash_password
|
||||
from models import User, Tryout, TryoutRegistration, Evaluation, Team, TeamMember, OrgTeam, PlayerDisponibility, UserGamertag, CoachAvailability, TeamNote, PersonalNote, Match, MatchParticipant
|
||||
from models import User, Tryout, TryoutRegistration, Evaluation, Team, TeamMember, OrgTeam, PlayerDisponibility, UserGamertag, CoachAvailability, TeamNote, PersonalNote, Match, MatchParticipant, TeamPlayer
|
||||
from datetime import datetime, timedelta, time
|
||||
import random
|
||||
|
||||
@@ -30,6 +30,7 @@ def seed_database():
|
||||
db.session.execute(text('DELETE FROM player_disponibilities'))
|
||||
db.session.execute(text('DELETE FROM match_participants'))
|
||||
db.session.execute(text('DELETE FROM matches'))
|
||||
db.session.execute(text('DELETE FROM team_players'))
|
||||
db.session.execute(text('DELETE FROM team_members'))
|
||||
db.session.execute(text('DELETE FROM teams'))
|
||||
db.session.execute(text('DELETE FROM evaluations'))
|
||||
@@ -323,19 +324,20 @@ def seed_database():
|
||||
db.session.commit()
|
||||
print("[OK] Created 2 tryout-specific teams with player assignments")
|
||||
|
||||
# Assign players to organization teams
|
||||
# Assign players to organization teams (using TeamPlayer for many-to-many)
|
||||
org_team_assignments = [
|
||||
(org_teams[0], players[0]),
|
||||
(org_teams[0], players[1]),
|
||||
(org_teams[0], players[2]),
|
||||
(org_teams[1], players[3]),
|
||||
(org_teams[1], players[4]),
|
||||
(org_teams[1], players[5]),
|
||||
(org_teams[2], players[6]),
|
||||
(org_teams[2], players[7]),
|
||||
(org_teams[0], players[0], 'starter'),
|
||||
(org_teams[0], players[1], 'starter'),
|
||||
(org_teams[0], players[2], 'substitute'),
|
||||
(org_teams[1], players[3], 'starter'),
|
||||
(org_teams[1], players[4], 'starter'),
|
||||
(org_teams[1], players[5], 'substitute'),
|
||||
(org_teams[2], players[6], 'starter'),
|
||||
(org_teams[2], players[7], 'substitute'),
|
||||
]
|
||||
for org_team, player in org_team_assignments:
|
||||
player.team_id = org_team.id
|
||||
for org_team, player, status in org_team_assignments:
|
||||
tp = TeamPlayer(player_id=player.id, org_team_id=org_team.id, status=status)
|
||||
db.session.add(tp)
|
||||
db.session.commit()
|
||||
|
||||
# Create sample disponibilities for players
|
||||
|
||||
Reference in New Issue
Block a user