volleyballsimtypes 0.0.414 → 0.0.416
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -40,12 +40,12 @@ export type Match = Omit<DataProps<_Match>, 'sets' | 'homeTeam' | 'awayTeam' | '
|
|
|
40
40
|
export type RallyEvent = DataProps<_RallyEvent> & {
|
|
41
41
|
team?: Team;
|
|
42
42
|
};
|
|
43
|
-
export type Player = Omit<DataProps<_Player>, 'stats'> & {
|
|
43
|
+
export type Player = Omit<DataProps<_Player>, 'stats' | 'birthAge' | 'birthIteration' | 'declineProfile'> & Partial<Pick<DataProps<_Player>, 'birthAge' | 'birthIteration' | 'declineProfile'>> & {
|
|
44
44
|
stats?: PerformanceStats;
|
|
45
45
|
teamId: string;
|
|
46
46
|
jerseyNumber: number;
|
|
47
|
-
locked
|
|
48
|
-
declineStatus
|
|
47
|
+
locked?: boolean;
|
|
48
|
+
declineStatus?: DeclineStatus;
|
|
49
49
|
};
|
|
50
50
|
export interface StartingLineup {
|
|
51
51
|
[CourtPosition.LEFT_FRONT]: string;
|
|
@@ -4,15 +4,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
7
|
+
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
7
8
|
const uuid_1 = require("uuid");
|
|
8
9
|
const match_1 = require("./match");
|
|
9
10
|
const utils_1 = require("../utils");
|
|
10
11
|
const data_1 = require("../../data");
|
|
12
|
+
dayjs_1.default.extend(utc_1.default);
|
|
11
13
|
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
12
14
|
class MatchGenerator {
|
|
13
15
|
static generateMatches(teams, baseDate) {
|
|
14
16
|
const t = new Set(teams.map(x => x.id));
|
|
15
|
-
|
|
17
|
+
// Anchor the first match to 00:00 UTC of the iteration's start day (Monday), so league rounds fall on the
|
|
18
|
+
// same wall-clock time everywhere regardless of the host timezone. startOf('day') in UTC avoids the
|
|
19
|
+
// local-timezone roll the old startOf('hour') was exposed to on a fractional-hour-offset host.
|
|
20
|
+
let date = dayjs_1.default.utc(baseDate).startOf('day');
|
|
16
21
|
if (t.size !== teams.length) {
|
|
17
22
|
throw new Error('DUPLICATE_TEAMS');
|
|
18
23
|
}
|
|
@@ -40,12 +40,12 @@ export type Match = Omit<DataProps<_Match>, 'sets' | 'homeTeam' | 'awayTeam' | '
|
|
|
40
40
|
export type RallyEvent = DataProps<_RallyEvent> & {
|
|
41
41
|
team?: Team;
|
|
42
42
|
};
|
|
43
|
-
export type Player = Omit<DataProps<_Player>, 'stats'> & {
|
|
43
|
+
export type Player = Omit<DataProps<_Player>, 'stats' | 'birthAge' | 'birthIteration' | 'declineProfile'> & Partial<Pick<DataProps<_Player>, 'birthAge' | 'birthIteration' | 'declineProfile'>> & {
|
|
44
44
|
stats?: PerformanceStats;
|
|
45
45
|
teamId: string;
|
|
46
46
|
jerseyNumber: number;
|
|
47
|
-
locked
|
|
48
|
-
declineStatus
|
|
47
|
+
locked?: boolean;
|
|
48
|
+
declineStatus?: DeclineStatus;
|
|
49
49
|
};
|
|
50
50
|
export interface StartingLineup {
|
|
51
51
|
[CourtPosition.LEFT_FRONT]: string;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
|
+
import utc from 'dayjs/plugin/utc';
|
|
2
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
3
4
|
import { Match } from './match';
|
|
4
5
|
import { shuffle } from '../utils';
|
|
5
6
|
import { StatusEnum } from '../../data';
|
|
7
|
+
dayjs.extend(utc);
|
|
6
8
|
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
7
9
|
export default class MatchGenerator {
|
|
8
10
|
static generateMatches(teams, baseDate) {
|
|
9
11
|
const t = new Set(teams.map(x => x.id));
|
|
10
|
-
|
|
12
|
+
// Anchor the first match to 00:00 UTC of the iteration's start day (Monday), so league rounds fall on the
|
|
13
|
+
// same wall-clock time everywhere regardless of the host timezone. startOf('day') in UTC avoids the
|
|
14
|
+
// local-timezone roll the old startOf('hour') was exposed to on a fractional-hour-offset host.
|
|
15
|
+
let date = dayjs.utc(baseDate).startOf('day');
|
|
11
16
|
if (t.size !== teams.length) {
|
|
12
17
|
throw new Error('DUPLICATE_TEAMS');
|
|
13
18
|
}
|