Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move round-robin ranking calculation to the manager #43

Open
Drarig29 opened this issue Mar 14, 2021 · 0 comments
Open

Move round-robin ranking calculation to the manager #43

Drarig29 opened this issue Mar 14, 2021 · 0 comments

Comments

@Drarig29
Copy link
Owner

Drarig29 commented Mar 14, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant