Exclude same-round departures from games played

This commit is contained in:
2026-10-08 16:12:13 -04:00
parent 63e084e38f
commit a18635fb78
8 changed files with 73 additions and 7 deletions
@@ -141,3 +141,15 @@ it('accepts each efficiency metric through the API when the qualified group is e
summary: { players: 1, matches: 4, kills: 80 } });
}
});
it('does not use same-round departures to qualify for efficiency rankings', async () => {
const { db } = await import('../../src/lib/server/db/index.js');
addSamples(db(), 'short-visit', [...samples(4), { completed: 0 }]);
db().prepare(`UPDATE leaderboard_match_players SET first_observed_round = highest_round
WHERE completed = 0`).run();
const { getLeaderboard } = await import('../../src/lib/server/fleet/leaderboard.js');
expect(getLeaderboard().entries[0]).toMatchObject({ gamesPlayed: 4, gamesCompleted: 4,
kills: 100, averageKills: 25, completionRate: 1 });
const { efficiencyMetrics } = await import('../../src/lib/leaderboard-efficiency.js');
for (const { key } of efficiencyMetrics) expect(getLeaderboard({ metric: key }).entries).toEqual([]);
});