Skip to content

Commit

Permalink
Handle case where no team is leading
Browse files Browse the repository at this point in the history
  • Loading branch information
SpacialCircumstances committed Jul 4, 2024
1 parent e44b4f6 commit 5cf226a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions server/services/leaderboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,13 @@ export default class LeaderboardService {
return team.team.players.map(pId => this.playerService.getById(game, pId)!).filter(p => !p.defeated).length > 0;
});

if (!leadingTeam) {
return {
ranks: [],
eloRating: null
};
}

const nonAfkInLeadingTeam = leadingTeam.team.players
.flatMap(pId => {
const player = this.playerService.getById(game, pId);
Expand Down

0 comments on commit 5cf226a

Please sign in to comment.