feat: add limited round-robin scheduling
This commit is contained in:
1 parent
24983aeb09
commit
658592973e
15 files changed
+403
-63
No files matched your search
@@ -24,10 +24,12 @@ function createService() {
|
||||
interface MatchOverrides {
|
||||
gameCount?: number;
|
||||
gameMode?: 'pair' | 'bracket' | 'round-robin';
|
||||
roundRobinMaxRounds?: number;
|
||||
participants?: Array<{ excluded?: boolean }>;
|
||||
teams?: Array<{ teamIndex: number }>;
|
||||
gameSchedule?: Array<{
|
||||
gameNumber: number;
|
||||
roundNumber?: number;
|
||||
teamAIndex: number;
|
||||
teamBIndex: number;
|
||||
}>;
|
||||
@@ -58,6 +60,20 @@ describe('TournamentResultService round-robin scheduling', () => {
|
||||
expect(service.resolveRequiredGameSlots(match)).toBe(15);
|
||||
});
|
||||
|
||||
it('calculates limited round-robin slots for polling', () => {
|
||||
const service = createService();
|
||||
const match = createMatch({
|
||||
gameMode: 'round-robin',
|
||||
gameCount: 1,
|
||||
roundRobinMaxRounds: 3,
|
||||
teams: Array.from({ length: 8 }, (_, index) => ({
|
||||
teamIndex: index + 1,
|
||||
})),
|
||||
});
|
||||
|
||||
expect(service.resolveRequiredGameSlots(match)).toBe(12);
|
||||
});
|
||||
|
||||
it('uses persisted round-robin schedule when mapping a game number', () => {
|
||||
const service = createService();
|
||||
const match = createMatch({
|
||||
|
||||
Reference in new issue
Block a user