volleyballsimtypes 0.0.181 → 0.0.184

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.
Files changed (59) hide show
  1. package/dist/cjs/src/data/init-models.js +8 -8
  2. package/dist/cjs/src/data/models/box-score.d.ts +69 -0
  3. package/dist/cjs/src/data/models/{match-set-stats.js → box-score.js} +60 -23
  4. package/dist/cjs/src/data/models/index.d.ts +1 -1
  5. package/dist/cjs/src/data/models/index.js +1 -1
  6. package/dist/cjs/src/data/models/match-set.d.ts +13 -13
  7. package/dist/cjs/src/data/models/player.d.ts +13 -13
  8. package/dist/cjs/src/data/transformers/box-score.d.ts +5 -0
  9. package/dist/cjs/src/data/transformers/box-score.js +77 -0
  10. package/dist/cjs/src/data/transformers/index.d.ts +1 -1
  11. package/dist/cjs/src/data/transformers/index.js +1 -1
  12. package/dist/cjs/src/data/transformers/match-set.js +3 -4
  13. package/dist/cjs/src/data/transformers/player.d.ts +1 -3
  14. package/dist/cjs/src/data/transformers/player.js +2 -49
  15. package/dist/cjs/src/service/match/box-score.d.ts +75 -0
  16. package/dist/cjs/src/service/match/box-score.js +64 -0
  17. package/dist/cjs/src/service/match/index.d.ts +1 -0
  18. package/dist/cjs/src/service/match/index.js +1 -0
  19. package/dist/cjs/src/service/match/match-set.d.ts +5 -28
  20. package/dist/cjs/src/service/match/match-set.js +3 -8
  21. package/dist/cjs/src/service/match/match.d.ts +0 -1
  22. package/dist/cjs/src/service/match/match.js +2 -4
  23. package/dist/cjs/src/service/match/rally.d.ts +4 -1
  24. package/dist/cjs/src/service/match/rally.js +2 -1
  25. package/dist/cjs/src/service/player/player.d.ts +4 -4
  26. package/dist/cjs/src/service/player/player.js +2 -2
  27. package/dist/esm/src/data/init-models.js +9 -9
  28. package/dist/esm/src/data/models/box-score.d.ts +69 -0
  29. package/dist/esm/src/data/models/{match-set-stats.js → box-score.js} +58 -21
  30. package/dist/esm/src/data/models/index.d.ts +1 -1
  31. package/dist/esm/src/data/models/index.js +1 -1
  32. package/dist/esm/src/data/models/match-set.d.ts +13 -13
  33. package/dist/esm/src/data/models/player.d.ts +13 -13
  34. package/dist/esm/src/data/transformers/box-score.d.ts +5 -0
  35. package/dist/esm/src/data/transformers/box-score.js +73 -0
  36. package/dist/esm/src/data/transformers/index.d.ts +1 -1
  37. package/dist/esm/src/data/transformers/index.js +1 -1
  38. package/dist/esm/src/data/transformers/match-set.js +4 -5
  39. package/dist/esm/src/data/transformers/player.d.ts +1 -3
  40. package/dist/esm/src/data/transformers/player.js +2 -47
  41. package/dist/esm/src/service/match/box-score.d.ts +75 -0
  42. package/dist/esm/src/service/match/box-score.js +53 -0
  43. package/dist/esm/src/service/match/index.d.ts +1 -0
  44. package/dist/esm/src/service/match/index.js +1 -0
  45. package/dist/esm/src/service/match/match-set.d.ts +5 -28
  46. package/dist/esm/src/service/match/match-set.js +3 -8
  47. package/dist/esm/src/service/match/match.d.ts +0 -1
  48. package/dist/esm/src/service/match/match.js +2 -4
  49. package/dist/esm/src/service/match/rally.d.ts +4 -1
  50. package/dist/esm/src/service/match/rally.js +2 -1
  51. package/dist/esm/src/service/player/player.d.ts +4 -4
  52. package/dist/esm/src/service/player/player.js +2 -2
  53. package/package.json +1 -1
  54. package/dist/cjs/src/data/models/match-set-stats.d.ts +0 -58
  55. package/dist/cjs/src/data/transformers/match-set-stats.d.ts +0 -5
  56. package/dist/cjs/src/data/transformers/match-set-stats.js +0 -62
  57. package/dist/esm/src/data/models/match-set-stats.d.ts +0 -58
  58. package/dist/esm/src/data/transformers/match-set-stats.d.ts +0 -5
  59. package/dist/esm/src/data/transformers/match-set-stats.js +0 -58
@@ -0,0 +1,75 @@
1
+ export interface AttackStats {
2
+ attempts: number;
3
+ kills: number;
4
+ errors: number;
5
+ }
6
+ export interface ServeStats {
7
+ attempts: number;
8
+ aces: number;
9
+ errors: number;
10
+ }
11
+ export interface ReceptionStats {
12
+ attempts: number;
13
+ perfect: number;
14
+ positive: number;
15
+ overpasses: number;
16
+ errors: number;
17
+ }
18
+ export interface BlockStats {
19
+ solo: number;
20
+ assists: number;
21
+ errors: number;
22
+ }
23
+ export interface SettingStats {
24
+ assists: number;
25
+ errors: number;
26
+ }
27
+ export interface DefenseStats {
28
+ digs: number;
29
+ errors: number;
30
+ }
31
+ /**
32
+ * Misc stats are about participation and rotation impact.
33
+ * These are *incredibly* useful for analytics and AI later.
34
+ */
35
+ export interface MiscStats {
36
+ /** Number of rallies this player was on the court in this set */
37
+ pointsPlayed: number;
38
+ /** Rallies won by the team while this player was on the court in this set */
39
+ pointsWonOnCourt: number;
40
+ /** How many distinct serve turns the player had in this set (i.e. times they went back to serve) */
41
+ serveTurns: number;
42
+ /** Number of sideout opportunities while the player was on court (optional but handy) */
43
+ sideoutOpportunities: number;
44
+ /** Number of successful sideouts while the player was on court (optional but handy) */
45
+ successfulSideouts: number;
46
+ }
47
+ /**
48
+ * Per-player, per-set box score row
49
+ * =================================
50
+ * This is the fundamental unit you store.
51
+ */
52
+ export interface BoxScore {
53
+ playerId: string;
54
+ matchSetId: string;
55
+ attack: AttackStats;
56
+ serve: ServeStats;
57
+ reception: ReceptionStats;
58
+ block: BlockStats;
59
+ setting: SettingStats;
60
+ defense: DefenseStats;
61
+ misc: MiscStats;
62
+ }
63
+ /**
64
+ * Utility: zeroed-out stat factories
65
+ * ==================================
66
+ * Handy to initialize objects when you start a new set.
67
+ */
68
+ export declare const createEmptyAttackStats: () => AttackStats;
69
+ export declare const createEmptyServeStats: () => ServeStats;
70
+ export declare const createEmptyReceptionStats: () => ReceptionStats;
71
+ export declare const createEmptyBlockStats: () => BlockStats;
72
+ export declare const createEmptySettingStats: () => SettingStats;
73
+ export declare const createEmptyDefenseStats: () => DefenseStats;
74
+ export declare const createEmptyMiscStats: () => MiscStats;
75
+ export declare const createEmptyBoxScore: (playerId: string, matchSetId: string) => BoxScore;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createEmptyBoxScore = exports.createEmptyMiscStats = exports.createEmptyDefenseStats = exports.createEmptySettingStats = exports.createEmptyBlockStats = exports.createEmptyReceptionStats = exports.createEmptyServeStats = exports.createEmptyAttackStats = void 0;
4
+ /**
5
+ * Utility: zeroed-out stat factories
6
+ * ==================================
7
+ * Handy to initialize objects when you start a new set.
8
+ */
9
+ const createEmptyAttackStats = () => ({
10
+ attempts: 0,
11
+ kills: 0,
12
+ errors: 0
13
+ });
14
+ exports.createEmptyAttackStats = createEmptyAttackStats;
15
+ const createEmptyServeStats = () => ({
16
+ attempts: 0,
17
+ aces: 0,
18
+ errors: 0
19
+ });
20
+ exports.createEmptyServeStats = createEmptyServeStats;
21
+ const createEmptyReceptionStats = () => ({
22
+ attempts: 0,
23
+ perfect: 0,
24
+ positive: 0,
25
+ overpasses: 0,
26
+ errors: 0
27
+ });
28
+ exports.createEmptyReceptionStats = createEmptyReceptionStats;
29
+ const createEmptyBlockStats = () => ({
30
+ solo: 0,
31
+ assists: 0,
32
+ errors: 0
33
+ });
34
+ exports.createEmptyBlockStats = createEmptyBlockStats;
35
+ const createEmptySettingStats = () => ({
36
+ assists: 0,
37
+ errors: 0
38
+ });
39
+ exports.createEmptySettingStats = createEmptySettingStats;
40
+ const createEmptyDefenseStats = () => ({
41
+ digs: 0,
42
+ errors: 0
43
+ });
44
+ exports.createEmptyDefenseStats = createEmptyDefenseStats;
45
+ const createEmptyMiscStats = () => ({
46
+ pointsPlayed: 0,
47
+ pointsWonOnCourt: 0,
48
+ serveTurns: 0,
49
+ sideoutOpportunities: 0,
50
+ successfulSideouts: 0
51
+ });
52
+ exports.createEmptyMiscStats = createEmptyMiscStats;
53
+ const createEmptyBoxScore = (playerId, matchSetId) => ({
54
+ playerId,
55
+ matchSetId,
56
+ attack: (0, exports.createEmptyAttackStats)(),
57
+ serve: (0, exports.createEmptyServeStats)(),
58
+ reception: (0, exports.createEmptyReceptionStats)(),
59
+ block: (0, exports.createEmptyBlockStats)(),
60
+ setting: (0, exports.createEmptySettingStats)(),
61
+ defense: (0, exports.createEmptyDefenseStats)(),
62
+ misc: (0, exports.createEmptyMiscStats)()
63
+ });
64
+ exports.createEmptyBoxScore = createEmptyBoxScore;
@@ -1,3 +1,4 @@
1
+ export * from './box-score';
1
2
  export * from './match';
2
3
  export * from './match-rating';
3
4
  export * from './match-set';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./box-score"), exports);
17
18
  __exportStar(require("./match"), exports);
18
19
  __exportStar(require("./match-rating"), exports);
19
20
  __exportStar(require("./match-set"), exports);
@@ -1,9 +1,7 @@
1
1
  import { PlayerPosition, Rally } from './rally';
2
2
  import { MatchTeam } from './match-team';
3
- declare enum ScoreThreshold {
4
- SET = 25,
5
- TIE_BREAK = 15
6
- }
3
+ import { BoxScore } from './box-score';
4
+ type ScoreThreshold = 25 | 15;
7
5
  interface MatchSetParams {
8
6
  readonly id: string;
9
7
  readonly order: number;
@@ -12,42 +10,21 @@ interface MatchSetParams {
12
10
  readonly awayPlayerPosition: PlayerPosition[];
13
11
  readonly homeScore: number;
14
12
  readonly awayScore: number;
15
- readonly stats: SetStatistics[];
13
+ readonly boxScores: BoxScore[];
16
14
  readonly rallies: Rally[];
17
15
  }
18
- export interface EventStat {
19
- success: number;
20
- error: number;
21
- }
22
- export interface SetStatistics {
23
- readonly playerId: string;
24
- order: number;
25
- ace: number;
26
- attempts: number;
27
- contacts: number;
28
- ralliesPlayed: number;
29
- serve: EventStat;
30
- reception: EventStat;
31
- set: EventStat;
32
- attack: EventStat;
33
- block: EventStat;
34
- kills: number;
35
- killBlocks: number;
36
- assists: number;
37
- setsPlayed: number;
38
- }
39
16
  export declare class MatchSet {
40
17
  readonly id: string;
41
18
  readonly order: number;
42
19
  readonly isTieBreak: boolean;
43
20
  readonly homePlayerPosition: PlayerPosition[];
44
21
  readonly awayPlayerPosition: PlayerPosition[];
45
- readonly stats: SetStatistics[];
22
+ readonly boxScores: BoxScore[];
46
23
  readonly rallies: Rally[];
47
24
  readonly scoreThreshold: ScoreThreshold;
48
25
  private _homeScore;
49
26
  private _awayScore;
50
- constructor({ id, order, isTieBreak, homePlayerPosition, awayPlayerPosition, stats, rallies, homeScore, awayScore }: MatchSetParams);
27
+ constructor({ id, order, isTieBreak, homePlayerPosition, awayPlayerPosition, boxScores, rallies, homeScore, awayScore }: MatchSetParams);
51
28
  get homeScore(): number;
52
29
  get awayScore(): number;
53
30
  increaseScore(team: MatchTeam): void;
@@ -3,13 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MatchSet = void 0;
4
4
  const utils_1 = require("../utils");
5
5
  const match_team_1 = require("./match-team");
6
- var ScoreThreshold;
7
- (function (ScoreThreshold) {
8
- ScoreThreshold[ScoreThreshold["SET"] = 25] = "SET";
9
- ScoreThreshold[ScoreThreshold["TIE_BREAK"] = 15] = "TIE_BREAK";
10
- })(ScoreThreshold || (ScoreThreshold = {}));
11
6
  class MatchSet {
12
- constructor({ id, order, isTieBreak, homePlayerPosition, awayPlayerPosition, stats, rallies, homeScore, awayScore }) {
7
+ constructor({ id, order, isTieBreak, homePlayerPosition, awayPlayerPosition, boxScores, rallies, homeScore, awayScore }) {
13
8
  (0, utils_1.validateUUID)(id);
14
9
  this.id = id;
15
10
  this.order = order;
@@ -17,10 +12,10 @@ class MatchSet {
17
12
  this._awayScore = awayScore;
18
13
  this.homePlayerPosition = homePlayerPosition;
19
14
  this.awayPlayerPosition = awayPlayerPosition;
20
- this.stats = stats;
15
+ this.boxScores = boxScores;
21
16
  this.rallies = rallies;
22
17
  this.isTieBreak = isTieBreak;
23
- this.scoreThreshold = isTieBreak ? ScoreThreshold.TIE_BREAK : ScoreThreshold.SET;
18
+ this.scoreThreshold = isTieBreak ? 15 : 25;
24
19
  }
25
20
  get homeScore() {
26
21
  return this._homeScore;
@@ -22,7 +22,6 @@ export declare enum MatchScore {
22
22
  '0-3' = "0-3"
23
23
  }
24
24
  export declare class Match {
25
- static readonly BEST_OF = 5;
26
25
  readonly id: string;
27
26
  readonly homeTeam: Team;
28
27
  readonly awayTeam: Team;
@@ -27,7 +27,7 @@ class Match {
27
27
  this.winner = winner;
28
28
  }
29
29
  addSet(set) {
30
- if (this.sets.length >= Match.BEST_OF)
30
+ if (this.sets.length >= 5)
31
31
  throw new Error('SET_AMOUNT_EXCEEDED');
32
32
  this.sets.push(set);
33
33
  }
@@ -38,13 +38,12 @@ class Match {
38
38
  return `${this.getTeamSets(match_team_1.MatchTeam.HOME)}-${this.getTeamSets(match_team_1.MatchTeam.AWAY)}`;
39
39
  }
40
40
  isOver() {
41
- const gamesRequired = Math.ceil(Match.BEST_OF / 2);
41
+ const gamesRequired = 3;
42
42
  const lastSet = this.sets.at(-1);
43
43
  if (lastSet == null || !lastSet.isOver() || this.sets.length < gamesRequired)
44
44
  return false;
45
45
  const homeSets = this.getTeamSets(match_team_1.MatchTeam.HOME);
46
46
  const awaySets = this.getTeamSets(match_team_1.MatchTeam.AWAY);
47
- // Check if any of the teams has enough sets to win.
48
47
  return !(homeSets < gamesRequired && awaySets < gamesRequired);
49
48
  }
50
49
  getWinner() {
@@ -65,4 +64,3 @@ class Match {
65
64
  }
66
65
  }
67
66
  exports.Match = Match;
68
- Match.BEST_OF = 5;
@@ -1,10 +1,12 @@
1
1
  import { CourtPosition } from './court-position';
2
2
  import { RallyEvent } from '../event';
3
+ import { Team } from '../team';
3
4
  interface RallyParams {
4
5
  readonly id: string;
5
6
  readonly order: number;
6
7
  readonly servingTeamId: string;
7
8
  readonly events: RallyEvent[];
9
+ winner?: Team;
8
10
  }
9
11
  export interface PlayerPosition {
10
12
  position: CourtPosition;
@@ -15,7 +17,8 @@ export declare class Rally {
15
17
  readonly servingTeamId: string;
16
18
  readonly events: RallyEvent[];
17
19
  readonly order: number;
18
- constructor({ id, order, servingTeamId, events }: RallyParams);
20
+ winner?: Team;
21
+ constructor({ id, order, servingTeamId, events, winner }: RallyParams);
19
22
  addEvent(event: RallyEvent): void;
20
23
  }
21
24
  export {};
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Rally = void 0;
4
4
  const utils_1 = require("../utils");
5
5
  class Rally {
6
- constructor({ id, order, servingTeamId, events }) {
6
+ constructor({ id, order, servingTeamId, events, winner }) {
7
7
  (0, utils_1.validateUUID)(id);
8
8
  this.id = id;
9
9
  this.order = order;
10
10
  this.servingTeamId = servingTeamId;
11
11
  this.events = events;
12
+ this.winner = winner;
12
13
  }
13
14
  addEvent(event) {
14
15
  this.events.push(event);
@@ -4,7 +4,7 @@ import { Country } from '../country';
4
4
  import { Rarity } from './rarity';
5
5
  import { Stats } from './stats';
6
6
  import { Role } from './role';
7
- import { SetStatistics } from '../match';
7
+ import { BoxScore } from '../match';
8
8
  export declare class Stat {
9
9
  readonly name: Stats;
10
10
  readonly value: number;
@@ -22,7 +22,7 @@ interface PlayerParams {
22
22
  readonly roles: Role[];
23
23
  readonly traits: Trait[];
24
24
  readonly rarity: Rarity;
25
- readonly gameStats?: SetStatistics[];
25
+ readonly boxScores?: BoxScore[];
26
26
  }
27
27
  export declare class Name {
28
28
  readonly first: string;
@@ -42,8 +42,8 @@ export declare class Player {
42
42
  readonly traits: Trait[];
43
43
  readonly generalStats: Stat[];
44
44
  readonly rarity: Rarity;
45
- readonly gameStats?: SetStatistics[];
46
- constructor({ id, name, country, stats, roles, traits, rarity, gameStats }: PlayerParams);
45
+ readonly boxScores?: BoxScore[];
46
+ constructor({ id, name, country, stats, roles, traits, rarity, boxScores }: PlayerParams);
47
47
  static sortPlayers(roles: Role[]): (p1: Player, p2: Player) => number;
48
48
  static compareStats(p1: Player, p2: Player): number;
49
49
  toString(): string;
@@ -25,7 +25,7 @@ class Name {
25
25
  }
26
26
  exports.Name = Name;
27
27
  class Player {
28
- constructor({ id, name, country, stats, roles, traits, rarity, gameStats }) {
28
+ constructor({ id, name, country, stats, roles, traits, rarity, boxScores }) {
29
29
  (0, utils_1.validateUUID)(id);
30
30
  this.id = id;
31
31
  this.name = name;
@@ -34,7 +34,7 @@ class Player {
34
34
  this.roles = roles;
35
35
  this.traits = traits;
36
36
  this.rarity = rarity;
37
- this.gameStats = gameStats;
37
+ this.boxScores = boxScores;
38
38
  this.generalStats = Object.values(stats_1.StatsEnum).map((stat) => ({
39
39
  name: stat,
40
40
  value: (0, stats_1.calculateStatScore)(stats, stat)
@@ -1,4 +1,4 @@
1
- import { CoachModel, CompetitionChampionModel, CompetitionMatchModel, CompetitionModel, CompetitionTeamsModel, CountryModel, DraftModel, DraftPickModel, IterationModel, LeagueModel, LeagueSeasonModel, MatchModel, MatchRatingModel, MatchResultModel, MatchSetModel, MatchSetStatsModel, PerformanceStatsModel, PlayerModel, PlayerTeamModel, RallyModel, SetPositionModel, TeamModel, UserModel } from './models';
1
+ import { BoxScoreModel, CoachModel, CompetitionChampionModel, CompetitionMatchModel, CompetitionModel, CompetitionTeamsModel, CountryModel, DraftModel, DraftPickModel, IterationModel, LeagueModel, LeagueSeasonModel, MatchModel, MatchRatingModel, MatchResultModel, MatchSetModel, PerformanceStatsModel, PlayerModel, PlayerTeamModel, RallyModel, SetPositionModel, TeamModel, UserModel } from './models';
2
2
  export function initModels(sequelize) {
3
3
  const Coach = CoachModel.initModel(sequelize);
4
4
  const Country = CountryModel.initModel(sequelize);
@@ -15,7 +15,7 @@ export function initModels(sequelize) {
15
15
  const MatchRating = MatchRatingModel.initModel(sequelize);
16
16
  const MatchResult = MatchResultModel.initModel(sequelize);
17
17
  const MatchSet = MatchSetModel.initModel(sequelize);
18
- const MatchSetStats = MatchSetStatsModel.initModel(sequelize);
18
+ const BoxScore = BoxScoreModel.initModel(sequelize);
19
19
  const PerformanceStats = PerformanceStatsModel.initModel(sequelize);
20
20
  const Player = PlayerModel.initModel(sequelize);
21
21
  const PlayerTeam = PlayerTeamModel.initModel(sequelize);
@@ -81,15 +81,15 @@ export function initModels(sequelize) {
81
81
  });
82
82
  MatchSet.belongsToMany(Player, {
83
83
  as: 'SetStatsPlayers',
84
- through: MatchSetStats,
84
+ through: BoxScore,
85
85
  foreignKey: 'match_set_id',
86
86
  otherKey: 'player_id'
87
87
  });
88
- MatchSet.hasMany(MatchSetStats, { as: 'MatchSetStats', foreignKey: 'match_set_id' });
88
+ MatchSet.hasMany(BoxScore, { as: 'BoxScore', foreignKey: 'match_set_id' });
89
89
  MatchSet.hasMany(Rally, { as: 'Rallies', foreignKey: 'match_set_id' });
90
90
  MatchSet.hasMany(SetPosition, { as: 'SetPositions', foreignKey: 'match_set_id' });
91
- MatchSetStats.belongsTo(MatchSet, { as: 'matchSet', foreignKey: 'match_set_id' });
92
- MatchSetStats.belongsTo(Player, { as: 'player', foreignKey: 'player_id' });
91
+ BoxScore.belongsTo(MatchSet, { as: 'matchSet', foreignKey: 'match_set_id' });
92
+ BoxScore.belongsTo(Player, { as: 'player', foreignKey: 'player_id' });
93
93
  PerformanceStats.belongsTo(Player, { as: 'player', foreignKey: 'player_id' });
94
94
  Player.belongsTo(Country, { as: 'country', foreignKey: 'country_id' });
95
95
  Player.belongsToMany(MatchSet, {
@@ -100,7 +100,7 @@ export function initModels(sequelize) {
100
100
  });
101
101
  Player.belongsToMany(MatchSet, {
102
102
  as: 'StatsMatchSets',
103
- through: MatchSetStats,
103
+ through: BoxScore,
104
104
  foreignKey: 'player_id',
105
105
  otherKey: 'match_set_id'
106
106
  });
@@ -110,7 +110,7 @@ export function initModels(sequelize) {
110
110
  foreignKey: 'player_id',
111
111
  otherKey: 'team_id'
112
112
  });
113
- Player.hasMany(MatchSetStats, { as: 'MatchSetStats', foreignKey: 'player_id' });
113
+ Player.hasMany(BoxScore, { as: 'BoxScore', foreignKey: 'player_id' });
114
114
  Player.hasMany(PlayerTeam, { as: 'PlayerTeams', foreignKey: 'player_id' });
115
115
  Player.hasMany(SetPosition, { as: 'SetPositions', foreignKey: 'player_id' });
116
116
  Player.hasOne(DraftPick, { as: 'DraftPick', foreignKey: 'player_id' });
@@ -167,7 +167,7 @@ export function initModels(sequelize) {
167
167
  MatchRating,
168
168
  MatchResult,
169
169
  MatchSet,
170
- MatchSetStats,
170
+ BoxScore,
171
171
  PerformanceStats,
172
172
  Player,
173
173
  PlayerTeam,
@@ -0,0 +1,69 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { Model } from 'sequelize';
3
+ import { MatchSetId, MatchSetModel, PlayerId, PlayerModel } from '.';
4
+ export interface BoxScoreAttributes {
5
+ player_id: string;
6
+ match_set_id: string;
7
+ attack_attempts: number;
8
+ attack_kills: number;
9
+ attack_errors: number;
10
+ serve_attempts: number;
11
+ serve_aces: number;
12
+ serve_errors: number;
13
+ reception_attempts: number;
14
+ reception_perfect: number;
15
+ reception_positive: number;
16
+ reception_overpasses: number;
17
+ reception_errors: number;
18
+ block_solo: number;
19
+ block_assists: number;
20
+ block_errors: number;
21
+ setting_assists: number;
22
+ setting_errors: number;
23
+ defense_digs: number;
24
+ defense_errors: number;
25
+ misc_points_played: number;
26
+ misc_points_won_on_court: number;
27
+ misc_serve_turns: number;
28
+ misc_sideout_opportunities: number;
29
+ misc_successful_sideouts: number;
30
+ }
31
+ export type BoxScorePk = 'player_id' | 'match_set_id';
32
+ export type BoxScoreId = BoxScoreModel[BoxScorePk];
33
+ export type BoxScoreCreationAttributes = BoxScoreAttributes;
34
+ export declare class BoxScoreModel extends Model<BoxScoreAttributes, BoxScoreCreationAttributes> implements BoxScoreAttributes {
35
+ player_id: string;
36
+ match_set_id: string;
37
+ attack_attempts: number;
38
+ attack_kills: number;
39
+ attack_errors: number;
40
+ serve_attempts: number;
41
+ serve_aces: number;
42
+ serve_errors: number;
43
+ reception_attempts: number;
44
+ reception_perfect: number;
45
+ reception_positive: number;
46
+ reception_overpasses: number;
47
+ reception_errors: number;
48
+ block_solo: number;
49
+ block_assists: number;
50
+ block_errors: number;
51
+ setting_assists: number;
52
+ setting_errors: number;
53
+ defense_digs: number;
54
+ defense_errors: number;
55
+ misc_points_played: number;
56
+ misc_points_won_on_court: number;
57
+ misc_serve_turns: number;
58
+ misc_sideout_opportunities: number;
59
+ misc_successful_sideouts: number;
60
+ Player: PlayerModel;
61
+ getPlayer: Sequelize.BelongsToGetAssociationMixin<PlayerModel>;
62
+ setPlayer: Sequelize.BelongsToSetAssociationMixin<PlayerModel, PlayerId>;
63
+ createPlayer: Sequelize.BelongsToCreateAssociationMixin<PlayerModel>;
64
+ MatchSet: MatchSetModel;
65
+ getMatchSet: Sequelize.BelongsToGetAssociationMixin<MatchSetModel>;
66
+ setMatchSet: Sequelize.BelongsToSetAssociationMixin<MatchSetModel, MatchSetId>;
67
+ createMatchSet: Sequelize.BelongsToCreateAssociationMixin<MatchSetModel>;
68
+ static initModel(sequelize: Sequelize.Sequelize): typeof BoxScoreModel;
69
+ }
@@ -1,7 +1,7 @@
1
1
  import { DataTypes, Model } from 'sequelize';
2
- export class MatchSetStatsModel extends Model {
2
+ export class BoxScoreModel extends Model {
3
3
  static initModel(sequelize) {
4
- return MatchSetStatsModel.init({
4
+ return BoxScoreModel.init({
5
5
  player_id: {
6
6
  type: DataTypes.UUID,
7
7
  allowNull: false,
@@ -20,98 +20,135 @@ export class MatchSetStatsModel extends Model {
20
20
  key: 'match_set_id'
21
21
  }
22
22
  },
23
- aces: {
23
+ // Attack
24
+ attack_attempts: {
24
25
  type: DataTypes.INTEGER,
25
26
  allowNull: false,
26
27
  defaultValue: 0
27
28
  },
28
- attempts: {
29
+ attack_kills: {
29
30
  type: DataTypes.INTEGER,
30
31
  allowNull: false,
31
32
  defaultValue: 0
32
33
  },
33
- contacts: {
34
+ attack_errors: {
34
35
  type: DataTypes.INTEGER,
35
36
  allowNull: false,
36
37
  defaultValue: 0
37
38
  },
38
- rallies_played: {
39
+ // Serve
40
+ serve_attempts: {
39
41
  type: DataTypes.INTEGER,
40
42
  allowNull: false,
41
43
  defaultValue: 0
42
44
  },
43
- serve_success: {
45
+ serve_aces: {
44
46
  type: DataTypes.INTEGER,
45
47
  allowNull: false,
46
48
  defaultValue: 0
47
49
  },
48
- serve_error: {
50
+ serve_errors: {
49
51
  type: DataTypes.INTEGER,
50
52
  allowNull: false,
51
53
  defaultValue: 0
52
54
  },
53
- reception_success: {
55
+ // Reception
56
+ reception_attempts: {
54
57
  type: DataTypes.INTEGER,
55
58
  allowNull: false,
56
59
  defaultValue: 0
57
60
  },
58
- reception_error: {
61
+ reception_perfect: {
59
62
  type: DataTypes.INTEGER,
60
63
  allowNull: false,
61
64
  defaultValue: 0
62
65
  },
63
- set_success: {
66
+ reception_positive: {
64
67
  type: DataTypes.INTEGER,
65
68
  allowNull: false,
66
69
  defaultValue: 0
67
70
  },
68
- set_error: {
71
+ reception_overpasses: {
69
72
  type: DataTypes.INTEGER,
70
73
  allowNull: false,
71
74
  defaultValue: 0
72
75
  },
73
- attack_success: {
76
+ reception_errors: {
74
77
  type: DataTypes.INTEGER,
75
78
  allowNull: false,
76
79
  defaultValue: 0
77
80
  },
78
- attack_error: {
81
+ // Block
82
+ block_solo: {
79
83
  type: DataTypes.INTEGER,
80
84
  allowNull: false,
81
85
  defaultValue: 0
82
86
  },
83
- block_success: {
87
+ block_assists: {
84
88
  type: DataTypes.INTEGER,
85
89
  allowNull: false,
86
90
  defaultValue: 0
87
91
  },
88
- block_error: {
92
+ block_errors: {
89
93
  type: DataTypes.INTEGER,
90
94
  allowNull: false,
91
95
  defaultValue: 0
92
96
  },
93
- kills: {
97
+ // Setting
98
+ setting_assists: {
94
99
  type: DataTypes.INTEGER,
95
100
  allowNull: false,
96
101
  defaultValue: 0
97
102
  },
98
- kill_blocks: {
103
+ setting_errors: {
99
104
  type: DataTypes.INTEGER,
100
105
  allowNull: false,
101
106
  defaultValue: 0
102
107
  },
103
- assists: {
108
+ // Defense
109
+ defense_digs: {
110
+ type: DataTypes.INTEGER,
111
+ allowNull: false,
112
+ defaultValue: 0
113
+ },
114
+ defense_errors: {
115
+ type: DataTypes.INTEGER,
116
+ allowNull: false,
117
+ defaultValue: 0
118
+ },
119
+ // Misc
120
+ misc_points_played: {
121
+ type: DataTypes.INTEGER,
122
+ allowNull: false,
123
+ defaultValue: 0
124
+ },
125
+ misc_points_won_on_court: {
126
+ type: DataTypes.INTEGER,
127
+ allowNull: false,
128
+ defaultValue: 0
129
+ },
130
+ misc_serve_turns: {
131
+ type: DataTypes.INTEGER,
132
+ allowNull: false,
133
+ defaultValue: 0
134
+ },
135
+ misc_sideout_opportunities: {
136
+ type: DataTypes.INTEGER,
137
+ allowNull: false,
138
+ defaultValue: 0
139
+ },
140
+ misc_successful_sideouts: {
104
141
  type: DataTypes.INTEGER,
105
142
  allowNull: false,
106
143
  defaultValue: 0
107
144
  }
108
145
  }, {
109
146
  sequelize,
110
- tableName: 'MatchSetStats',
147
+ tableName: 'BoxScore',
111
148
  schema: 'public',
112
149
  timestamps: false,
113
150
  indexes: [{
114
- name: 'MatchSetStats_pk',
151
+ name: 'BoxScore_pk',
115
152
  unique: true,
116
153
  fields: [
117
154
  { name: 'player_id' },
@@ -1,3 +1,4 @@
1
+ export * from './box-score';
1
2
  export * from './coach';
2
3
  export * from './competition';
3
4
  export * from './competition-champion';
@@ -13,7 +14,6 @@ export * from './match';
13
14
  export * from './match-rating';
14
15
  export * from './match-result';
15
16
  export * from './match-set';
16
- export * from './match-set-stats';
17
17
  export * from './performance-stats';
18
18
  export * from './player';
19
19
  export * from './player-team';