diff --git a/api/src/models/results.ts b/api/src/models/results.ts index 5e7046c..7add03a 100644 --- a/api/src/models/results.ts +++ b/api/src/models/results.ts @@ -85,6 +85,8 @@ export class Results { "tournaments.players_count as players_count", "tournaments.format as format", ]) + // Only fetch results for non-disabled users + .where("users.disabled", "=", 0) .select((eb) => [ eb.fn .agg("rank") diff --git a/api/src/tests/leaderboard.spec.ts b/api/src/tests/leaderboard.spec.ts index ed4b3f4..353d0c3 100644 --- a/api/src/tests/leaderboard.spec.ts +++ b/api/src/tests/leaderboard.spec.ts @@ -387,10 +387,7 @@ describe("leaderboard", () => { const rows = (await response.json()) as LeaderboardRowComponentType[]; expect(rows[0].rank).toEqual(1); - expect(rows[0].user_id).toEqual(0); - expect(rows[0].user_name).toEqual(null); - - expect(rows[1].rank).toEqual(2); - expect(rows[1].user_id).toEqual(u1.id); + expect(rows[0].user_id).toEqual(1); + expect(rows.length).toEqual(1); }); }); diff --git a/api/src/tests/tournaments.spec.ts b/api/src/tests/tournaments.spec.ts index 5afb13f..1649aec 100644 --- a/api/src/tests/tournaments.spec.ts +++ b/api/src/tests/tournaments.spec.ts @@ -106,11 +106,7 @@ describe("tournaments", () => { expect(data[0].rank_cut).toBe(1); expect(data[0].rank_swiss).toBe(1); - // Disabled user - expect(data[1].user_id).toBe(0); - expect(data[1].user_name).toBe(null); - expect(data[1].points_earned).toBe(50); - expect(data[1].rank_cut).toBe(2); - expect(data[1].rank_swiss).toBe(2); + // Disabled user should not be in this list + expect(data.length).toBe(1); }); });