Skip to content

Commit

Permalink
add n offset
Browse files Browse the repository at this point in the history
  • Loading branch information
tctree333 committed Mar 2, 2022
1 parent 43d1573 commit 4a987b5
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/interpreter/superscore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
// the exported function returns a `rep` object, which
// can be passed back into the interpreter class for handling.

import { Interpreter, PlacingRep, SciOlyFF, Team, TeamRep } from "./types";
import {
Interpreter,
PlacingRep,
SciOlyFF,
Team,
TeamRep,
TournamentRep,
} from "./types";

const fsn = (t: { school: string; city?: string; state: string }) =>
`${t.school}|${t.city ?? ""}|${t.state}`;
Expand Down Expand Up @@ -38,7 +45,6 @@ export default (interpreter: Interpreter): SciOlyFF => {
interpreter.placings.forEach((placing) => {
const event = placing.event?.name as string;
const school = teamNumbers.get(fsn(placing.team as Team)) as number;

if (!minPlacingsBySchool.has(school)) {
minPlacingsBySchool.set(school, new Map());
}
Expand Down Expand Up @@ -83,8 +89,16 @@ export default (interpreter: Interpreter): SciOlyFF => {
}
}

const tournamentRep: TournamentRep = {
...interpreter.tournament.rep,
};

tournamentRep["n offset"] =
(interpreter.tournament.nOffset as number) +
((interpreter.tournament.teams?.length as number) - teamNumbers.size);

return {
Tournament: interpreter.tournament.rep,
Tournament: tournamentRep,
Events: interpreter.events.map((e) => e.rep),
Teams: teams,
Placings: placingsRep,
Expand Down

0 comments on commit 4a987b5

Please sign in to comment.