This commit is contained in:
@@ -61,7 +61,14 @@ class OrgTeam(db.Model):
|
||||
return [tp.player for tp in self.team_players]
|
||||
|
||||
def get_players_with_status(self):
|
||||
return [
|
||||
{'player': tp.player, 'status': tp.status, 'position': tp.position}
|
||||
rows = [
|
||||
{
|
||||
'player': tp.player,
|
||||
'status': tp.status,
|
||||
'position': tp.position,
|
||||
'is_team_representative': tp.is_team_representative,
|
||||
}
|
||||
for tp in self.team_players
|
||||
]
|
||||
# The responsible heads the roster; everyone else keeps roster order.
|
||||
return sorted(rows, key=lambda row: not row['is_team_representative'])
|
||||
|
||||
@@ -12,6 +12,10 @@ class TeamPlayer(db.Model):
|
||||
player_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
|
||||
org_team_id = db.Column(db.Integer, db.ForeignKey('org_teams.id'), nullable=False)
|
||||
status = db.Column(db.String(20), nullable=False, default='starter')
|
||||
#: A player an admin named as their team's responsible ("joueur
|
||||
#: responsable") — see app/permissions.py. Grants match-management
|
||||
#: rights for that one team and nothing else.
|
||||
is_team_representative = db.Column(db.Boolean, nullable=False, default=False)
|
||||
position = db.Column(db.String(50), nullable=True)
|
||||
added_at = db.Column(db.DateTime, default=utc_now_naive)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user