Pure functions in src/lib/scoring implementing docs/SCORING.md: cell values (override > judge average), weighted raw totals, raw and placement points with tie averaging, and competition-ranked standings. Coverage thresholds are enforced at 100% for the module. Also silences the hydration warning caused by browser extensions modifying <html>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
798 B
TypeScript
21 lines
798 B
TypeScript
import { computeGame } from "./game";
|
|
import { computeStandings } from "./standings";
|
|
import type { EventResult, ScoringInput } from "./types";
|
|
|
|
export { computeCell } from "./cell";
|
|
export { computeGame } from "./game";
|
|
export { round2 } from "./round";
|
|
export { computeStandings } from "./standings";
|
|
export type * from "./types";
|
|
|
|
/** The one entry point: admin view, scoreboard API and judge view all call this. */
|
|
export function computeEvent(input: ScoringInput): EventResult {
|
|
const gameResults = input.games.map((game) =>
|
|
computeGame(game, input.teams, input.criteria, input.judges, input.scores),
|
|
);
|
|
return {
|
|
games: Object.fromEntries(gameResults.map((result) => [result.gameId, result])),
|
|
standings: computeStandings(input.teams, gameResults, input.adjustments),
|
|
};
|
|
}
|