QUA-002, premiere moitie. **Ce commit ne fait que reformater** : aucun changement de comportement, aucune ligne de logique touchee. 72 fichiers, 4 restaient deja conformes. Il est isole exprès, pour que `git log -p` sur les commits voisins reste lisible. `quote-style = "preserve"` etait deja pose dans pyproject.toml, ce qui evite le brassage guillemets simples / doubles : le diff porte sur les retours a la ligne, l indentation des appels longs et les virgules finales, pas sur le style de chaine. Verification : 263 tests passent avant et apres, ruff check propre. L activation en CI arrive dans le commit suivant, separement, pour que ce diff-ci ne contienne rien d autre. Co-Authored-By: Claude Opus 5 <[email protected]>
43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
"""Coach — evaluates, schedules matches, manages their own org teams."""
|
|
|
|
from app.models.user_model.user import User
|
|
|
|
|
|
class Coach(User):
|
|
"""Coach — evaluates, schedules matches, manages their own org teams.
|
|
|
|
Every question about *which* teams or tryouts belong to this coach is
|
|
delegated to ``app.permissions``. Two of the three methods below used to
|
|
answer it themselves, each considering a different subset of the two
|
|
ways a coach can be attached to a team: ``can_manage_this_tryout``
|
|
ignored the legacy ``coach_id`` column when checking the target team,
|
|
and ``get_visible_tryouts`` ignored it entirely. A coach attached only
|
|
by that column therefore saw an empty calendar (ARCH-002).
|
|
"""
|
|
|
|
__mapper_args__ = {'polymorphic_identity': 'coach'}
|
|
|
|
def can_evaluate(self):
|
|
return True
|
|
|
|
def can_schedule_matches(self):
|
|
return True
|
|
|
|
def can_manage_tryouts(self):
|
|
return True
|
|
|
|
def can_manage_this_tryout(self, tryout):
|
|
from app.permissions import coach_manages_tryout
|
|
|
|
return coach_manages_tryout(self, tryout)
|
|
|
|
def can_manage_this_org_team(self, org_team):
|
|
if org_team.coaches.filter_by(id=self.id).first():
|
|
return True
|
|
return org_team.coach_id == self.id
|
|
|
|
def get_visible_tryouts(self):
|
|
from app.permissions import coach_tryouts
|
|
|
|
return coach_tryouts(self)
|