volleyballsimtypes 0.0.70 → 0.0.71

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.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformFromMatchRating = void 0;
4
4
  const service_1 = require("../../service");
5
5
  function transformToAttributes(team, rating) {
6
- const teamId = team === service_1.MatchTeam.HOME ? rating.home.id : rating.away.id;
6
+ const teamId = team === service_1.MatchTeam.HOME ? rating.match.homeTeam.id : rating.match.awayTeam.id;
7
7
  if (team == null)
8
8
  throw new Error(`INVALID_TEAM: ${teamId}`);
9
9
  return {
@@ -1,16 +1,11 @@
1
1
  import { Match, MatchTeam } from '.';
2
- import { Team } from '../team';
3
2
  interface MatchRatingOpts {
4
- readonly home: Team;
5
- readonly away: Team;
6
3
  readonly match: Match;
7
4
  }
8
5
  export declare class MatchRating {
9
6
  static K: number;
10
- readonly home: Team;
11
- readonly away: Team;
12
7
  readonly match: Match;
13
- constructor({ home, away, match }: MatchRatingOpts);
8
+ constructor({ match }: MatchRatingOpts);
14
9
  getWinProbability(team: MatchTeam): number;
15
10
  getRatingChange(team: MatchTeam): number;
16
11
  }
@@ -3,21 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MatchRating = void 0;
4
4
  const _1 = require(".");
5
5
  class MatchRating {
6
- constructor({ home, away, match }) {
7
- this.home = home;
8
- this.away = away;
6
+ constructor({ match }) {
9
7
  this.match = match;
10
8
  }
11
9
  getWinProbability(team) {
12
10
  let rA;
13
11
  let rB;
14
12
  if (team === _1.MatchTeam.HOME) {
15
- rA = this.home.rating;
16
- rB = this.away.rating;
13
+ rA = this.match.homeTeam.rating;
14
+ rB = this.match.awayTeam.rating;
17
15
  }
18
16
  else {
19
- rA = this.away.rating;
20
- rB = this.home.rating;
17
+ rA = this.match.awayTeam.rating;
18
+ rB = this.match.homeTeam.rating;
21
19
  }
22
20
  return 1 / (1 + Math.pow(10, ((rB - rA) / 400)));
23
21
  }
@@ -1,6 +1,6 @@
1
1
  import { MatchTeam } from '../../service';
2
2
  function transformToAttributes(team, rating) {
3
- const teamId = team === MatchTeam.HOME ? rating.home.id : rating.away.id;
3
+ const teamId = team === MatchTeam.HOME ? rating.match.homeTeam.id : rating.match.awayTeam.id;
4
4
  if (team == null)
5
5
  throw new Error(`INVALID_TEAM: ${teamId}`);
6
6
  return {
@@ -1,16 +1,11 @@
1
1
  import { Match, MatchTeam } from '.';
2
- import { Team } from '../team';
3
2
  interface MatchRatingOpts {
4
- readonly home: Team;
5
- readonly away: Team;
6
3
  readonly match: Match;
7
4
  }
8
5
  export declare class MatchRating {
9
6
  static K: number;
10
- readonly home: Team;
11
- readonly away: Team;
12
7
  readonly match: Match;
13
- constructor({ home, away, match }: MatchRatingOpts);
8
+ constructor({ match }: MatchRatingOpts);
14
9
  getWinProbability(team: MatchTeam): number;
15
10
  getRatingChange(team: MatchTeam): number;
16
11
  }
@@ -1,20 +1,18 @@
1
1
  import { MatchTeam } from '.';
2
2
  export class MatchRating {
3
- constructor({ home, away, match }) {
4
- this.home = home;
5
- this.away = away;
3
+ constructor({ match }) {
6
4
  this.match = match;
7
5
  }
8
6
  getWinProbability(team) {
9
7
  let rA;
10
8
  let rB;
11
9
  if (team === MatchTeam.HOME) {
12
- rA = this.home.rating;
13
- rB = this.away.rating;
10
+ rA = this.match.homeTeam.rating;
11
+ rB = this.match.awayTeam.rating;
14
12
  }
15
13
  else {
16
- rA = this.away.rating;
17
- rB = this.home.rating;
14
+ rA = this.match.awayTeam.rating;
15
+ rB = this.match.homeTeam.rating;
18
16
  }
19
17
  return 1 / (1 + Math.pow(10, ((rB - rA) / 400)));
20
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volleyballsimtypes",
3
- "version": "0.0.70",
3
+ "version": "0.0.71",
4
4
  "description": "vbsim types",
5
5
  "main": "./dist/cjs/src/index.js",
6
6
  "module": "./dist/esm/src/index.js",