Files
team-tryouts/seed.py
T
cedrick2711 4ed42d5ec8 Ajout de booking pour des One on One avec son coach,
Demande par discord au coach pour confirmer la rencontre
Ajout de message automatisé discord pour avertir des nouveaux match et rappel 24h a l'avance
2026-07-17 15:32:32 -04:00

521 lines
27 KiB
Python

"""Database seeding script for Team Tryouts application.
This module provides functions to seed the database with sample data including
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 datetime import datetime, timedelta, time
import random
def seed_database():
"""Seed the database with sample data for development and testing.
Creates sample users with different roles (president, manager, coach, player, scout),
organization teams, tryouts, registrations, evaluations, and player disponibilities.
All existing data is cleared before seeding.
The function creates:
- 7 admin users (president, 2 managers, 3 coaches, 1 scout)
- 10 player users with E-Sports profiles
- 4 organization teams
- 4 tryouts
- Registrations and evaluations
- Player disponibilities for match scheduling
"""
# Clear existing data
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_members'))
db.session.execute(text('DELETE FROM teams'))
db.session.execute(text('DELETE FROM evaluations'))
db.session.execute(text('DELETE FROM tryout_registrations'))
db.session.execute(text('DELETE FROM tryouts'))
db.session.execute(text('DELETE FROM org_teams'))
db.session.execute(text('DELETE FROM user_gamertags'))
db.session.execute(text('DELETE FROM users'))
db.session.commit()
# Create users with different roles
users_data = [
{'username': 'president', 'password': 'password', 'role': 'president', 'full_name': 'Sarah Johnson', 'email': '[email protected]', 'phone': '555-0101'},
{'username': 'manager1', 'password': 'password', 'role': 'manager', 'full_name': 'Mike Williams', 'email': '[email protected]', 'phone': '555-0102'},
{'username': 'manager2', 'password': 'password', 'role': 'manager', 'full_name': 'Emily Davis', 'email': '[email protected]', 'phone': '555-0103'},
{'username': 'coach1', 'password': 'password', 'role': 'coach', 'full_name': 'Coach Thompson', 'email': '[email protected]', 'phone': '555-0104', 'discord_user_id': '484107446298738689'},
{'username': 'coach2', 'password': 'password', 'role': 'coach', 'full_name': 'Coach Martinez', 'email': '[email protected]', 'phone': '555-0105'},
{'username': 'coach3', 'password': 'password', 'role': 'coach', 'full_name': 'Coach Anderson', 'email': '[email protected]', 'phone': '555-0106'},
{'username': 'scout1', 'password': 'password', 'role': 'scout', 'full_name': 'Alex Rivera', 'email': '[email protected]', 'phone': '555-0107'},
]
# Create players with E-Sports profile data (gamertags per game)
player_data = [
{'username': 'jplayer1', 'full_name': 'nordjan', 'email': '[email protected]', 'games': 'Valorant, Counter-Strike 2, Rainbow Six Siege, Rocket League, Overwatch 2',
'gamertags': {'Valorant': 'nordjan#bad', 'Counter-Strike 2': 'nordjan', 'Rainbow Six Siege': 'n0rd-vpn', 'Rocket League': 'nordjiano'},
'discord': 'nordjan', 'discord_user_id': '484107446298738689', 'league_os': 'https://leagueos.gg/player/nordjan'},
{'username': 'jplayer2', 'full_name': 'Emma Garcia', 'email': '[email protected]', 'games': 'League of Legends,Valorant',
'gamertags': {'League of Legends': 'emmagarcia_lol', 'Valorant': 'emmagarcia_val'},
'discord': 'EmmaG#4452', 'league_os': 'https://leagueos.gg/player/emmagarcia'},
{'username': 'jplayer3', 'full_name': 'Liam Brown', 'email': '[email protected]', 'games': 'Apex Legends,Fortnite',
'gamertags': {'Apex Legends': 'liambrown_apex', 'platform': 'PC', 'Fortnite': 'liambrown_fn', 'platform_fn': 'PC'},
'discord': 'LiamB#8103', 'league_os': 'https://leagueos.gg/player/liambrown'},
{'username': 'jplayer4', 'full_name': 'Sophia Lee', 'email': '[email protected]', 'games': 'Overwatch 2,Valorant',
'gamertags': {'Overwatch 2': 'sophialee_ow', 'platform_ow': 'PC', 'Valorant': 'sophialee_val'},
'discord': 'SophiaL#3327', 'league_os': 'https://leagueos.gg/player/sophialee'},
{'username': 'jplayer5', 'full_name': 'Noah Taylor', 'email': '[email protected]', 'games': 'Counter-Strike 2,Rainbow Six Siege',
'gamertags': {'Counter-Strike 2': 'noahtaylor_cs', 'Rainbow Six Siege': 'noahtaylor_r6', 'platform_r6': 'PC'},
'discord': 'NoahT#6614', 'league_os': 'https://leagueos.gg/player/noahtaylor'},
{'username': 'jplayer6', 'full_name': 'Olivia Martin', 'email': '[email protected]', 'games': 'Rocket League,Fortnite',
'gamertags': {'Rocket League': 'oliviamartin_rl', 'platform_rl': 'PC', 'Fortnite': 'oliviamartin_fn', 'platform_fn': 'PC'},
'discord': 'OliviaM#2298', 'league_os': 'https://leagueos.gg/player/oliviamartin'},
{'username': 'jplayer7', 'full_name': 'Ethan Clark', 'email': '[email protected]', 'games': 'Valorant,Apex Legends',
'gamertags': {'Valorant': 'ethanclark_val', 'Apex Legends': 'ethanclark_apex', 'platform_apex': 'PC'},
'discord': 'EthanC#7743', 'league_os': 'https://leagueos.gg/player/ethanclark'},
{'username': 'jplayer8', 'full_name': 'Ava White', 'email': '[email protected]', 'games': 'League of Legends,Counter-Strike 2',
'gamertags': {'League of Legends': 'avawhite_lol', 'Counter-Strike 2': 'avawhite_cs'},
'discord': 'AvaW#5561', 'league_os': 'https://leagueos.gg/player/avawhite'},
{'username': 'jplayer9', 'full_name': 'Mason Hall', 'email': '[email protected]', 'games': 'Call of Duty,Rocket League',
'gamertags': {'Call of Duty': 'masonhall_cod', 'platform_cod': 'PC', 'Rocket League': 'masonhall_rl', 'platform_rl': 'PC'},
'discord': 'MasonH#1189', 'league_os': 'https://leagueos.gg/player/masonhall'},
{'username': 'jplayer10', 'full_name': 'Isabella Adams', 'email': '[email protected]', 'games': 'Overwatch 2,Dota 2',
'gamertags': {'Overwatch 2': 'isabellaadams_ow', 'platform_ow': 'PC', 'Dota 2': 'isabellaadams_dota'},
'discord': 'IsabellaA#4437', 'league_os': 'https://leagueos.gg/player/isabellaadams'},
]
for i, data in enumerate(player_data, start=10):
users_data.append({
'username': data['username'], 'password': 'password', 'role': 'player',
'full_name': data['full_name'], 'email': data['email'], 'phone': f'555-01{i:02d}',
'games': data['games'], 'gamertags': data.get('gamertags', {}),
'discord_username': data['discord'], 'discord_user_id': data['discord_user_id'], 'league_os_profile': data['league_os']
})
users = []
for data in users_data:
hashed_pw = hash_password(data['password'])
user = User(
username=data['username'],
password_hash=hashed_pw,
role=data['role'],
full_name=data['full_name'],
email=data['email'],
phone=data.get('phone', ''),
games=data.get('games'),
discord_username=data.get('discord_username'),
discord_user_id=data.get('discord_user_id'),
league_os_profile=data.get('league_os_profile')
)
db.session.add(user)
users.append(user)
db.session.commit()
print(f"[OK] Created {len(users)} users")
# Map users for easy access
user_map = {u.username: u for u in users}
president = user_map['president']
manager1 = user_map['manager1']
manager2 = user_map['manager2']
coaches = [user_map['coach1'], user_map['coach2'], user_map['coach3']]
scout = user_map['scout1']
players = [user_map[f'jplayer{i}'] for i in range(1, 11)]
# Create gamertags for players
gamertag_data = [
{'user': users[7], 'game': 'Valorant', 'gamertag': 'nordjan#bad'},
{'user': users[7], 'game': 'Counter-Strike 2', 'gamertag': 'nordjan'},
{'user': users[7], 'game': 'Rainbow Six Siege', 'gamertag': 'nordjan', 'platform': 'Ubisoft'},
{'user': users[7], 'game': 'Rocket League', 'gamertag': 'nordjiano', 'platform': 'Epic'},
{'user': users[7], 'game': 'Overwatch 2', 'gamertag': 'nordjan', 'platform': 'PC'},
{'user': users[8], 'game': 'League of Legends', 'gamertag': 'emmagarcia_lol'},
{'user': users[8], 'game': 'Valorant', 'gamertag': 'emmagarcia_val'},
{'user': users[9], 'game': 'Apex Legends', 'gamertag': 'liambrown_apex', 'platform': 'PC'},
{'user': users[9], 'game': 'Fortnite', 'gamertag': 'liambrown_fn', 'platform': 'PC'},
{'user': users[10], 'game': 'Overwatch 2', 'gamertag': 'sophialee_ow', 'platform': 'PC'},
{'user': users[10], 'game': 'Valorant', 'gamertag': 'sophialee_val'},
{'user': users[11], 'game': 'Counter-Strike 2', 'gamertag': 'noahtaylor_cs'},
{'user': users[11], 'game': 'Rainbow Six Siege', 'gamertag': 'noahtaylor_r6', 'platform': 'Ubisoft'},
{'user': users[12], 'game': 'Rocket League', 'gamertag': 'oliviamartin_rl', 'platform': 'Epic'},
{'user': users[12], 'game': 'Fortnite', 'gamertag': 'oliviamartin_fn', 'platform': 'PC'},
{'user': users[13], 'game': 'Valorant', 'gamertag': 'ethanclark_val'},
{'user': users[13], 'game': 'Apex Legends', 'gamertag': 'ethanclark_apex', 'platform': 'PC'},
{'user': users[14], 'game': 'League of Legends', 'gamertag': 'avawhite_lol'},
{'user': users[14], 'game': 'Counter-Strike 2', 'gamertag': 'avawhite_cs'},
{'user': users[15], 'game': 'Call of Duty', 'gamertag': 'masonhall_cod', 'platform': 'PC'},
{'user': users[15], 'game': 'Rocket League', 'gamertag': 'masonhall_rl', 'platform': 'Epic'},
{'user': users[16], 'game': 'Overwatch 2', 'gamertag': 'isabellaadams_ow', 'platform': 'PC'},
{'user': users[16], 'game': 'Dota 2', 'gamertag': 'isabellaadams_dota'},
]
for gt in gamertag_data:
gamertag = UserGamertag(
user_id=gt['user'].id,
game=gt['game'],
gamertag=gt['gamertag'],
platform=gt.get('platform')
)
db.session.add(gamertag)
db.session.commit()
print(f"[OK] Created {len(gamertag_data)} user gamertags")
# Create Organization Teams (OrgTeams)
org_teams_data = [
{'name': 'Rocket League main', 'coach': coaches[0], 'creator': president},
{'name': 'CS2', 'coach': coaches[1], 'creator': president},
{'name': 'Valorant', 'coach': coaches[2], 'creator': president},
{'name': 'Rocket League acad', 'coach': None, 'creator': manager1},
]
org_teams = []
for data in org_teams_data:
ot = OrgTeam(
name=data['name'],
coach_id=data['coach'].id if data['coach'] else None,
created_by=data['creator'].id
)
db.session.add(ot)
org_teams.append(ot)
db.session.commit()
print(f"[OK] Created {len(org_teams)} organization teams")
# Create tryouts
tryouts_data = [
{'title': 'Rocket Leauge Tryouts', 'game': 'Rocket League', 'date': datetime.utcnow(), 'location': 'En ligne', 'description': 'Tryouts for the spring competitive season. All positions welcome.', 'status': 'in_progress', 'creator': manager1, 'target_team': org_teams[0]},
{'title': 'CS2 Tryouts', 'game': 'Counter-Strike 2', 'date': datetime.utcnow() + timedelta(days=4), 'location': 'En ligne', 'description': 'Trials for the fall select team. High skill level required.', 'status': 'upcoming', 'creator': manager1, 'target_team': org_teams[3]},
{'title': 'Valorant Tryouts', 'game': 'Valorant', 'date': datetime.utcnow() - timedelta(days=2), 'location': 'En ligne', 'description': 'Séléction pour l\'équipe de Valorant', 'status': 'in_progress', 'creator': manager2, 'target_team': org_teams[2]},
]
tryouts = []
for data in tryouts_data:
t = Tryout(
title=data['title'],
game=data['game'],
date=data['date'].date(),
location=data['location'],
description=data['description'],
status=data['status'],
max_players=15,
created_by=data['creator'].id,
target_org_team_id=data['target_team'].id if data['target_team'] else None
)
db.session.add(t)
tryouts.append(t)
db.session.commit()
print(f"[OK] Created {len(tryouts)} tryouts")
# Register players for tryouts
registrations_data = [
(tryouts[0], players[:3]),
(tryouts[1], players[3:5]),
(tryouts[2], players)
]
regs = []
for tryout, player_list in registrations_data:
for player in player_list:
reg = TryoutRegistration(
tryout_id=tryout.id,
player_id=player.id,
status=random.choice(['registered', 'attended', 'attended', 'no_show'])
)
db.session.add(reg)
regs.append(reg)
db.session.commit()
print(f"[OK] Created {len(regs)} registrations")
# Create evaluations (for in_progress and completed tryouts)
eval_data = []
# Spring tryout (Rocket League) - some evaluations
rl_positions = ['None needed', 'None', 'N/A']
for player in players[:8]:
for coach in coaches:
if random.random() > 0.3:
mecanics = random.randint(4, 10)
cohesion = random.randint(4, 10)
communication = random.randint(3, 10)
gamesense = random.randint(5, 10)
versatility = random.randint(5, 10)
discipline = random.randint(4, 10)
analysis = random.randint(4, 10)
sport_ethics = random.randint(5, 10)
mental = random.randint(5, 10)
overall = round((mecanics + cohesion + communication + gamesense + versatility + discipline + analysis + sport_ethics + mental) / 9, 1)
eval_entry = Evaluation(
tryout_id=tryouts[0].id,
player_id=player.id,
evaluator_id=coach.id,
mecanics_score=mecanics,
cohesion_score=cohesion,
communication_score=communication,
gamesense_score=gamesense,
versatility_score=versatility,
discipline_score=discipline,
analysis_score=analysis,
sport_ethics_score=sport_ethics,
mental_score=mental,
overall_score=overall,
comments=f"{'Great' if overall > 7 else 'Good'} performance. {'Shows promise.' if overall > 6 else 'Needs improvement in some areas.'}",
position_recommendation=random.choice(rl_positions)
)
db.session.add(eval_entry)
eval_data.append(eval_entry)
# Completed tryout (Valorant) - full evaluations
val_positions = ['Controller', 'Initiator', 'Duelist', 'Sentinel']
for player in players[:6]:
for coach in coaches[:2]:
mecanics = random.randint(3, 10)
cohesion = random.randint(3, 10)
communication = random.randint(3, 10)
gamesense = random.randint(4, 10)
versatility = random.randint(4, 10)
discipline = random.randint(3, 10)
analysis = random.randint(3, 10)
sport_ethics = random.randint(4, 10)
mental = random.randint(4, 10)
overall = round((mecanics + cohesion + communication + gamesense + versatility + discipline + analysis + sport_ethics + mental) / 9, 1)
eval_entry = Evaluation(
tryout_id=tryouts[2].id,
player_id=player.id,
evaluator_id=coach.id,
mecanics_score=mecanics,
cohesion_score=cohesion,
communication_score=communication,
gamesense_score=gamesense,
versatility_score=versatility,
discipline_score=discipline,
analysis_score=analysis,
sport_ethics_score=sport_ethics,
mental_score=mental,
overall_score=overall,
comments=f"{'Excellent' if overall > 8 else 'Solid'} display of skills during the camp.",
position_recommendation=random.choice(val_positions)
)
db.session.add(eval_entry)
eval_data.append(eval_entry)
db.session.commit()
print(f"[OK] Created {len(eval_data)} evaluations")
# Create teams for the completed tryout (tryout-specific teams)
team1 = Team(tryout_id=tryouts[2].id, name='Alpha Team', created_by=president.id)
team2 = Team(tryout_id=tryouts[2].id, name='Bravo Team', created_by=president.id)
db.session.add(team1)
db.session.add(team2)
db.session.commit()
# Assign players to teams (Valorant tryout uses Valorant positions)
val_positions = ['Controller', 'Initiator', 'Duelist', 'Sentinel']
team_members_data = [
(team1.id, players[0].id, random.choice(val_positions)),
(team1.id, players[1].id, random.choice(val_positions)),
(team1.id, players[2].id, random.choice(val_positions)),
(team1.id, players[3].id, random.choice(val_positions)),
(team2.id, players[4].id, random.choice(val_positions)),
(team2.id, players[5].id, random.choice(val_positions)),
]
for team_id, player_id, position in team_members_data:
tm = TeamMember(team_id=team_id, player_id=player_id, position=position)
db.session.add(tm)
db.session.commit()
print("[OK] Created 2 tryout-specific teams with player assignments")
# Assign players to organization teams
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]),
]
for org_team, player in org_team_assignments:
player.team_id = org_team.id
db.session.commit()
# Create sample disponibilities for players
# Time slots from 5pm to 11pm (stored as 17:00-23:00)
time_slots = [(17, 0), (17, 30), (18, 0), (18, 30), (19, 0), (19, 30), (20, 0), (20, 30), (21, 0), (21, 30), (22, 0), (22, 30), (23, 0)]
disponibilities = []
for player in players:
# Each player gets random disponibilities
for day in range(7): # All days of the week
num_slots = random.randint(3, 8)
chosen_slots = random.sample(time_slots, min(num_slots, len(time_slots)))
for hour, minute in chosen_slots:
start_time = time(hour, minute)
# End time is start_time + 30 minutes
end_minute = minute + 30
end_hour = hour
if end_minute >= 60:
end_minute -= 60
end_hour += 1
end_time = time(end_hour, end_minute)
d = PlayerDisponibility(
player_id=player.id,
day_of_week=day,
start_time=start_time,
end_time=end_time
)
db.session.add(d)
disponibilities.append(d)
# Create sample coach availabilities
coach_availabilities = []
coach_avail_time_slots = [(16, 0), (16, 30), (17, 0), (17, 30), (18, 0), (18, 30), (19, 0), (19, 30), (20, 0), (20, 30), (21, 0), (21, 30)]
# Only coaches with teams get availabilities
for coach, org_team in zip(coaches[:3], org_teams[:3]):
if coach.id == coaches[2].id: # Skip coach3 as they don't have all days
days_available = [0, 1, 2, 3, 4] # Mon-Fri
else:
days_available = [0, 1, 2, 3, 4, 5] # Mon-Sat
for day in days_available:
num_slots = random.randint(3, 5)
chosen_slots = random.sample(coach_avail_time_slots, min(num_slots, len(coach_avail_time_slots)))
for hour, minute in chosen_slots:
start_time = time(hour, minute)
end_minute = minute + 30
end_hour = hour
if end_minute >= 60:
end_minute -= 60
end_hour += 1
end_time = time(end_hour, end_minute)
ca = CoachAvailability(
coach_id=coach.id,
day_of_week=day,
start_time=start_time,
end_time=end_time
)
db.session.add(ca)
coach_availabilities.append(ca)
db.session.commit()
print(f"[OK] Created {len(coach_availabilities)} coach availabilities")
# Create team notes for each org team
team_notes_data = [
{
'team': org_teams[0],
'coach': coaches[0],
'content': 'Team, focus on rotation and positioning during scrims. We need to improve our mechanical consistency and work on post-platoon transitions. Remember to communicate clearly and stay positive!'
},
{
'team': org_teams[1],
'coach': coaches[1],
'content': 'Great progress this week! Keep working on your smoke lineups and utility usage. Individual practice on aim trainers is paying off. Next week we focus on map control and trading.'
},
{
'team': org_teams[2],
'coach': coaches[2],
'content': 'Agent comp needs work. Make sure to stick to your roles and trust your teammates. Work on your crosshair placement and pre-aim common angles. Team chemistry is key!'
},
]
for note_data in team_notes_data:
note = TeamNote(
org_team_id=note_data['team'].id,
coach_id=note_data['coach'].id,
content=note_data['content']
)
db.session.add(note)
db.session.commit()
print(f"[OK] Created {len(team_notes_data)} team notes")
# Create personal notes for players
personal_notes_data = [
{'player': players[0], 'coach': coaches[0], 'content': 'Your mechanics are improving! Focus on staying calm during high-pressure situations. Keep practicing those flip resets.'},
{'player': players[0], 'coach': coaches[0], 'content': 'Good positioning in last scrim. Work on your kickoffs - consistency will help the team.'},
{'player': players[1], 'coach': coaches[0], 'content': 'Your aerial game is strong. Try to be more aggressive on the ball when you have space.'},
{'player': players[3], 'coach': coaches[1], 'content': 'Need to work on your smoke grenade placement. Practice pre-aiming and strafe stopping.'},
{'player': players[4], 'coach': coaches[1], 'content': 'Good clutch performance! Keep your utility management consistent throughout rounds.'},
{'player': players[6], 'coach': coaches[2], 'content': 'Your aim trainer routine is paying off. Work on your agent abilities usage timing.'},
{'player': players[7], 'coach': coaches[2], 'content': 'Focus on communication in matches. Call out enemy positions clearly and ask for help when needed.'},
]
for note_data in personal_notes_data:
note = PersonalNote(
player_id=note_data['player'].id,
coach_id=note_data['coach'].id,
content=note_data['content']
)
db.session.add(note)
db.session.commit()
print(f"[OK] Created {len(personal_notes_data)} personal notes")
# Create sample matches for tryouts (for calendar testing)
matches_data = [
{'tryout': tryouts[0], 'title': 'Alpha vs Bravo', 'date': tryouts[0].date, 'start_time': time(18, 0), 'end_time': time(18, 30), 'match_type': 'team_vs_team', 'team1_id': team1.id if 'team1' in dir() else None},
{'tryout': tryouts[0], 'title': 'Bravo vs Alpha', 'date': tryouts[0].date, 'start_time': time(19, 0), 'end_time': time(19, 30), 'match_type': 'team_vs_team'},
{'tryout': tryouts[1], 'title': 'Scrimmage', 'date': tryouts[1].date, 'start_time': time(17, 0), 'end_time': time(17, 30), 'match_type': 'player_scrim'},
{'tryout': tryouts[2], 'title': 'Team Alpha Scrim', 'date': tryouts[2].date, 'start_time': time(18, 30), 'end_time': time(19, 0), 'match_type': 'player_vs_player'},
]
# Re-fetch teams after commit
team1 = Team.query.filter_by(name='Alpha Team').first()
team2 = Team.query.filter_by(name='Bravo Team').first()
matches = []
for i, m_data in enumerate(matches_data):
m = Match(
tryout_id=m_data['tryout'].id,
title=m_data['title'],
date=m_data['date'],
start_time=m_data['start_time'],
end_time=m_data['end_time'],
match_type=m_data['match_type'],
created_by=president.id,
team1_id=m_data.get('team1_id') or (team1.id if i < 2 else None),
team2_id=team2.id if i < 2 else None
)
db.session.add(m)
matches.append(m)
db.session.commit()
print(f"[OK] Created {len(matches)} matches")
# Add match participants for scrim matches
player_scrim_match = matches[2] if len(matches) > 2 else None
if player_scrim_match:
for player in players[3:5]:
mp = MatchParticipant(match_id=player_scrim_match.id, player_id=player.id)
db.session.add(mp)
pvp_match = matches[3] if len(matches) > 3 else None
if pvp_match and team1:
for player in players[:2]:
mp = MatchParticipant(match_id=pvp_match.id, player_id=player.id, team_side=1)
db.session.add(mp)
for player in players[2:4]:
mp = MatchParticipant(match_id=pvp_match.id, player_id=player.id, team_side=2)
db.session.add(mp)
db.session.commit()
print("[OK] Created match participants")
print("\n[SUCCESS] Database seeded successfully!")
print("\n=== Login Credentials ===")
print("President: username='president', password='password'")
print("Manager: username='manager1', password='password'")
print("Coach: username='coach1', password='password' (assigned to Varsity)")
print("Coach: username='coach2', password='password' (assigned to Junior Varsity)")
print("Coach: username='coach3', password='password' (assigned to U14 Development)")
print("Player: username='jplayer1', password='password'")
print("Scout: username='scout1', password='password'")
if __name__ == '__main__':
from app import create_app
app = create_app()
with app.app_context():
seed_database()