Skip to content

Commit

Permalink
halfstops yeah
Browse files Browse the repository at this point in the history
  • Loading branch information
sindrig committed Jun 5, 2024
1 parent cb032f8 commit f7dfab3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions admin/data/halfStops.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const groupStops: { [key: number]: number[] } = {
4: [35, 70, 80, 90],
3: [40, 80, 90, 100],
};
export default [45, 90, 105, 120];
1 change: 1 addition & 0 deletions admin/models/clock-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface MatchConfig extends NumericMatchConfigAttrs {
homeTeam: string;
homeTeamId: string;
inProgress?: MatchListMatch;
halfStops: number[];
}

export enum AssetTypes {
Expand Down
6 changes: 6 additions & 0 deletions admin/pages/control/[location]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { MatchListMatch } from "~/models/api-responses";
import type { MatchConfig, ControllerConfig } from "~/models/clock-config";
import type { MatchReport } from "~/models/api-responses";
import { transformPartialUpdates } from "~/utils/database";
import defaultHalfStops, { groupStops } from "~/data/halfStops";
import { ref as databaseRef, update } from "firebase/database";
const db = useDatabase();
Expand Down Expand Up @@ -39,7 +40,12 @@ watch([match, data], async () => {
homeTeamId: m.home.id,
awayTeam: m.away.name,
awayTeamId: m.away.id,
halfStops: defaultHalfStops,
};
const group = parseInt(m.competition.slice(0, 1), 10);
if (group && !isNaN(group) && groupStops[group]) {
matchConfig.halfStops = groupStops[group];
}
if (resetMatch.value) {
matchConfig.started = 0;
matchConfig.timeElapsed = 0;
Expand Down

0 comments on commit f7dfab3

Please sign in to comment.