Skip to content

Move round-robin ranking calculation to the manager #43

@Drarig29

Description

@Drarig29

The viewer should not have much logic. It should just display data created by the manager.

So round-robin ranking calculation should go in the manager's get module. Just as the standings.

export function getRanking(matches: Match[], formula?: RankingFormula): Ranking {
formula = formula || (
(item: RankingItem): number => 3 * item.wins + 1 * item.draws + 0 * item.losses
);
const rankingMap: RankingMap = {};
for (const match of matches) {
processParticipant(rankingMap, formula, match.opponent1, match.opponent2);
processParticipant(rankingMap, formula, match.opponent2, match.opponent1);
}
return createRanking(rankingMap);
}

Related: Drarig29/brackets-manager.js#69 Drarig29/brackets-manager.js#72

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions