Include suspect eligibility in ladderget responses
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
Node.js CI / build (20.x) (push) Waiting to run

This commit is contained in:
Mia 2024-11-01 13:25:29 -05:00
parent 61db6f5308
commit ffc676bfdc

View File

@ -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) {