diff --git a/app/features/leaderboards/LeaderboardRepository.server.test.ts b/app/features/leaderboards/LeaderboardRepository.server.test.ts index 7003c83d2..ea073f5cf 100644 --- a/app/features/leaderboards/LeaderboardRepository.server.test.ts +++ b/app/features/leaderboards/LeaderboardRepository.server.test.ts @@ -277,6 +277,14 @@ describe("LeaderboardRepository.findTeamLeaderboardBySeason", () => { }) ).map((entry) => [entry.identifier, entry.placementRank]); + const allRostersPlacements = async () => + ( + await LeaderboardRepository.findTeamLeaderboardBySeason({ + season: SEASON, + onlyOneEntryPerUser: false, + }) + ).map((entry) => [entry.identifier, entry.placementRank, entry.isSkipped]); + beforeEach(async () => { await users.create(9); await playSeasonInWith(topRoster()); @@ -300,6 +308,16 @@ describe("LeaderboardRepository.findTeamLeaderboardBySeason", () => { ]); }); + test("places a skipped team normally on the all rosters leaderboard", async () => { + await skipTeam(topRoster()); + + expect(await allRostersPlacements()).toEqual([ + [userIdsToIdentifier(topRoster()), 1, false], + [userIdsToIdentifier(sharedPlayersRoster()), 2, false], + [userIdsToIdentifier(beatenRoster()), 3, false], + ]); + }); + test("gives a team its placement back when it is unskipped", async () => { await skipTeam(topRoster()); await LeaderboardRepository.deleteTeamSkip({ diff --git a/app/features/leaderboards/LeaderboardRepository.server.ts b/app/features/leaderboards/LeaderboardRepository.server.ts index e8e2d8fc4..9c09044fc 100644 --- a/app/features/leaderboards/LeaderboardRepository.server.ts +++ b/app/features/leaderboards/LeaderboardRepository.server.ts @@ -121,9 +121,12 @@ export async function findTeamLeaderboardBySeason({ season: number; onlyOneEntryPerUser: boolean; }) { + // skipping is about the season finale qualification which the all rosters leaderboard is not concerned with const entries = addSkipped({ entries: await teamLeaderboardBySeasonQuery(season).execute(), - skippedIdentifiers: await findAllTeamSkipIdentifiersBySeason(season), + skippedIdentifiers: onlyOneEntryPerUser + ? await findAllTeamSkipIdentifiersBySeason(season) + : new Set(), }); const withNonSqPlayersHandled = onlyOneEntryPerUser ? await filterOutNonSqPlayers({ season, entries })