Active la regle isort (I) de ruff. 45 fichiers reordonnes, aucun changement de comportement : la suite passe avant comme apres. app/models/__init__.py en est exclu. Ses imports sont ranges en onze couches commentees qui decrivent le graphe de dependances ; trier par ordre alphabetique laisse chaque titre au-dessus d un import qu il ne decrit pas, et ce fichier n a qu un role, etre lu. Commit isole, comme le formatage : un diff de brassage ne doit pas servir de couverture a un changement de comportement.
39 lines
980 B
Python
39 lines
980 B
Python
"""Manager — manages own tryouts, all org teams, all contracts."""
|
|
|
|
from app.models.user_model.user import User
|
|
|
|
|
|
class Manager(User):
|
|
"""Manager — manages own tryouts, all org teams, all contracts."""
|
|
|
|
__mapper_args__ = {'polymorphic_identity': 'manager'}
|
|
|
|
def can_evaluate(self):
|
|
return True
|
|
|
|
def can_manage_teams(self):
|
|
return True
|
|
|
|
def can_manage_tryouts(self):
|
|
return True
|
|
|
|
def can_schedule_matches(self):
|
|
return True
|
|
|
|
def can_manage_this_tryout(self, tryout):
|
|
return tryout.created_by == self.id or tryout.manager_id == self.id
|
|
|
|
def can_manage_this_org_team(self, org_team):
|
|
return True
|
|
|
|
def get_visible_tryouts(self):
|
|
from sqlalchemy import or_
|
|
|
|
from app.models.tryout.tryout import Tryout
|
|
|
|
return (
|
|
Tryout.query.filter(or_(Tryout.created_by == self.id, Tryout.manager_id == self.id))
|
|
.order_by(Tryout.date)
|
|
.all()
|
|
)
|