ajouté dark mode et changer l'affichage des équipes dans les match. Changé les couleurs pour ressembler plus au couleur de l'udes

This commit is contained in:
cedrick2711
2026-07-14 23:34:56 -04:00
parent b19d5db8db
commit 5a090c0872
20 changed files with 632 additions and 107 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+48 -1
View File
@@ -1,8 +1,9 @@
from flask import Blueprint, render_template, redirect, url_for, flash
from flask_login import login_required, current_user
from extensions import db
from models import User, Tryout, Evaluation, TryoutRegistration, Team, TeamMember
from models import User, Tryout, Evaluation, TryoutRegistration, Team, TeamMember, Match, MatchParticipant
from sqlalchemy import func
from datetime import datetime, date
main_bp = Blueprint('main', __name__)
@@ -47,6 +48,52 @@ def dashboard():
stats['average_score'] = db.session.query(func.avg(Evaluation.overall_score)).filter_by(player_id=user.id).scalar() or 0
stats['my_registrations'] = TryoutRegistration.query.filter_by(player_id=user.id).order_by(TryoutRegistration.registered_at.desc()).limit(5).all()
stats['my_eval_list'] = Evaluation.query.filter_by(player_id=user.id).order_by(Evaluation.created_at.desc()).limit(5).all()
# Get next match for each tryout the player is in
today = date.today()
next_matches = []
for reg in stats['my_registrations']:
tryout = reg.tryout
# Find matches where player participates (team membership or direct participant)
player_teams = Team.query.join(TeamMember).filter(
Team.tryout_id == tryout.id,
TeamMember.player_id == user.id
).all()
# Get matches for this tryout that include the player
tryout_matches = Match.query.filter(
Match.tryout_id == tryout.id,
Match.status == 'scheduled'
).order_by(Match.date, Match.start_time).all()
for match in tryout_matches:
# Check if player is in this match
is_participant = False
if match.match_type == 'team_vs_team':
# Check if player is on team1 or team2
if match.team1_id in [t.id for t in player_teams] or match.team2_id in [t.id for t in player_teams]:
is_participant = True
else:
# Check if player is in match participants
participant = MatchParticipant.query.filter_by(
match_id=match.id,
player_id=user.id
).first()
if participant:
is_participant = True
if is_participant:
# Check if match is upcoming
match_date = match.date
if match_date >= today:
next_matches.append({
'tryout': tryout,
'match': match,
'team': player_teams[0] if player_teams else None
})
break # Only get the next match per tryout
stats['next_matches'] = next_matches
elif user.role == 'scout':
stats['total_players'] = User.query.filter_by(role='player').count()
+2 -2
View File
@@ -73,7 +73,7 @@ def api_events():
events.append({
'id': f'match_{match.id}',
'title': match.title + ' (' + participants_str + ')',
'title': match.title,
'date': match.date.strftime('%Y-%m-%d'),
'type': 'match',
'color': match_color,
@@ -181,7 +181,7 @@ def api_events_for_tryout(tryout_id):
events.append({
'id': f'match_{match.id}',
'title': match.title + ' (' + participants_str + ')',
'title': match.title,
'date': match.date.strftime('%Y-%m-%d'),
'type': 'match',
'color': match_color,
+6 -6
View File
@@ -172,13 +172,13 @@ def view_tryout(tryout_id):
'team2_players': [{'name': m.player.full_name, 'position': m.position} for m in match.team2.members.all()] if match.team2 else []
}
elif match.match_type == 'player_vs_player':
team1_players = [p.player.full_name for p in match.participants.filter_by(team_side=1).all()]
team2_players = [p.player.full_name for p in match.participants.filter_by(team_side=2).all()]
team1_players = [{'name': p.player.full_name, 'position': p.position} for p in match.participants.filter_by(team_side=1).all() if p.player]
team2_players = [{'name': p.player.full_name, 'position': p.position} for p in match.participants.filter_by(team_side=2).all() if p.player]
participants = {
'team1': ', '.join(team1_players) if team1_players else 'TBD',
'team2': ', '.join(team2_players) if team2_players else 'TBD',
'team1_player_names': team1_players,
'team2_player_names': team2_players
'team1': 'Team 1',
'team2': 'Team 2',
'team1_players': team1_players,
'team2_players': team2_players
}
else:
participants = [p.player.full_name for p in match.participants.all()]