Add player role sorting in webhook announcement

master
John Montagu, the 4th Earl of Sandvich 2025-05-17 02:30:00 -07:00
parent 300e925ab4
commit 8654db9125
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
1 changed files with 2 additions and 2 deletions

View File

@ -78,8 +78,8 @@ class Event(app_db.BaseModel):
def get_discord_content(self): def get_discord_content(self):
start_timestamp = int(self.start_time.timestamp()) start_timestamp = int(self.start_time.timestamp())
players = list(self.players) players = list(self.players)
# players with a role should be sorted first # players should be sorted by their role, leaving no-role players last
players.sort(key=lambda p: p.role is not None, reverse=True) players.sort(key=lambda p: p.role.role.value if p.role else 1023)
players_info = [] players_info = []
matchings = self.get_maximum_matching() matchings = self.get_maximum_matching()
ringers_needed = 6 - matchings ringers_needed = 6 - matchings