Correction des présences et correction de plusieurs erreurs mineur de déplacement/parcours de l'utilisateur, harmonisation des processus
This commit is contained in:
+16
-4
@@ -18,7 +18,7 @@ def can_manage():
|
||||
Returns:
|
||||
bool: True if user is president or manager.
|
||||
"""
|
||||
return current_user.role in ['president', 'manager']
|
||||
return current_user.role in ['admin', 'manager']
|
||||
|
||||
|
||||
@tryouts_bp.route('')
|
||||
@@ -35,7 +35,7 @@ def list_tryouts():
|
||||
Returns:
|
||||
Response: Rendered tryouts list template.
|
||||
"""
|
||||
if current_user.role == 'president':
|
||||
if current_user.role == 'admin':
|
||||
tryouts = Tryout.query.order_by(Tryout.date.desc()).all()
|
||||
elif current_user.role == 'manager':
|
||||
tryouts = Tryout.query.filter_by(created_by=current_user.id).order_by(Tryout.date.desc()).all()
|
||||
@@ -192,7 +192,7 @@ def view_tryout(tryout_id):
|
||||
|
||||
# Check if user has permission to view this tryout
|
||||
can_view = False
|
||||
if current_user.role == 'president':
|
||||
if current_user.role == 'admin':
|
||||
can_view = True
|
||||
elif current_user.role == 'manager' and tryout.created_by == current_user.id:
|
||||
can_view = True
|
||||
@@ -276,6 +276,17 @@ def view_tryout(tryout_id):
|
||||
confirmed_count = sum(1 for p in all_participants if p.attendance_confirmed)
|
||||
total_count = len(all_participants)
|
||||
|
||||
# Build per-player presence data for toggle buttons
|
||||
player_presence = []
|
||||
for p in all_participants:
|
||||
if p.player:
|
||||
player_presence.append({
|
||||
'participant_id': p.id,
|
||||
'player_id': p.player_id,
|
||||
'player_name': p.player.username,
|
||||
'attendance_confirmed': p.attendance_confirmed
|
||||
})
|
||||
|
||||
if match.match_type == 'team_vs_team':
|
||||
participants = {
|
||||
'team1': match.team1.name if match.team1 else 'TBD',
|
||||
@@ -299,7 +310,8 @@ def view_tryout(tryout_id):
|
||||
'match': match,
|
||||
'participants': participants,
|
||||
'confirmed_count': confirmed_count,
|
||||
'total_count': total_count
|
||||
'total_count': total_count,
|
||||
'player_presence': player_presence
|
||||
})
|
||||
|
||||
return render_template('pages/view_tryout.html',
|
||||
|
||||
Reference in New Issue
Block a user