Skip to content

Commit

Permalink
Include suspect eligibility in ladderget responses
Browse files Browse the repository at this point in the history
  • Loading branch information
mia-pi-git committed Nov 1, 2024
1 parent 61db6f5 commit ffc676b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,14 @@ export const actions: {[k: string]: QueryHandler} = {
const user = Ladder.isValidPlayer(params.user);
if (!user) throw new ActionError("Invalid username.");

return Ladder.getAllRatings(user);
const ratings = await Ladder.getAllRatings(user) as (LadderEntry & {suspect?: boolean})[];
for (const rating of ratings) {
const suspect = await tables.suspects.get(rating.formatid);
if (suspect) {
rating.suspect = !!rating.first_played && rating.first_played > suspect.start_date;
}
}
return ratings;
},

async mmr(params) {
Expand Down

0 comments on commit ffc676b

Please sign in to comment.