volleyballsimtypes 0.0.71 → 0.0.72

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.
@@ -13,7 +13,7 @@ class Season {
13
13
  }
14
14
  calculateStandings() {
15
15
  return this.teams.map(team => {
16
- const standing = new standing_1.Standing({ teamId: team.id });
16
+ const standing = new standing_1.Standing({ team });
17
17
  standing.calculateStanding(this.matches);
18
18
  return standing;
19
19
  }).sort(standing_1.Standing.sortFn);
@@ -24,7 +24,7 @@ class Season {
24
24
  this.standings.length = 0;
25
25
  this.standings.push(...this.calculateStandings());
26
26
  if (this.matches.every((match) => match.isSimulated)) {
27
- this.champion = this.teams.find((team) => team.id === this.standings[0].teamId);
27
+ this.champion = this.standings[0].team;
28
28
  }
29
29
  }
30
30
  }
@@ -1,9 +1,10 @@
1
1
  import { Match } from '../match';
2
+ import { Team } from '../team';
2
3
  interface StandingOpts {
3
- readonly teamId: string;
4
+ readonly team: Team;
4
5
  }
5
6
  export declare class Standing {
6
- readonly teamId: string;
7
+ readonly team: Team;
7
8
  won30: number;
8
9
  won31: number;
9
10
  won32: number;
@@ -20,7 +21,7 @@ export declare class Standing {
20
21
  matchesWon: number;
21
22
  matchesLost: number;
22
23
  totalMatches: number;
23
- constructor({ teamId }: StandingOpts);
24
+ constructor({ team }: StandingOpts);
24
25
  static sortFn(standingA: Standing, standingB: Standing): number;
25
26
  calculateStanding(matches: Match[]): void;
26
27
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Standing = void 0;
4
4
  const match_1 = require("../match");
5
5
  class Standing {
6
- constructor({ teamId }) {
6
+ constructor({ team }) {
7
7
  this.won30 = 0;
8
8
  this.won31 = 0;
9
9
  this.won32 = 0;
@@ -20,7 +20,7 @@ class Standing {
20
20
  this.matchesWon = 0;
21
21
  this.matchesLost = 0;
22
22
  this.totalMatches = 0;
23
- this.teamId = teamId;
23
+ this.team = team;
24
24
  }
25
25
  static sortFn(standingA, standingB) {
26
26
  if (standingB.points > standingA.points)
@@ -39,14 +39,14 @@ class Standing {
39
39
  return 0;
40
40
  }
41
41
  calculateStanding(matches) {
42
- matches = matches.filter(match => match.homeTeam.id === this.teamId || match.awayTeam.id === this.teamId)
42
+ matches = matches.filter(match => match.homeTeam.id === this.team.id || match.awayTeam.id === this.team.id)
43
43
  .filter(match => match.isOver());
44
44
  let teamSide;
45
45
  let otherSide;
46
46
  let teamScore;
47
47
  let otherScore;
48
48
  for (const match of matches) {
49
- if (this.teamId === match.homeTeam.id) {
49
+ if (this.team.id === match.homeTeam.id) {
50
50
  teamSide = match_1.MatchTeam.HOME;
51
51
  otherSide = match_1.MatchTeam.AWAY;
52
52
  }
@@ -54,7 +54,7 @@ class Standing {
54
54
  teamSide = match_1.MatchTeam.AWAY;
55
55
  otherSide = match_1.MatchTeam.HOME;
56
56
  }
57
- if (match.getWinner().id === this.teamId) {
57
+ if (match.getWinner().id === this.team.id) {
58
58
  this[`won3${match.getTeamSets(otherSide)}`]++;
59
59
  }
60
60
  else {
@@ -10,7 +10,7 @@ export class Season {
10
10
  }
11
11
  calculateStandings() {
12
12
  return this.teams.map(team => {
13
- const standing = new Standing({ teamId: team.id });
13
+ const standing = new Standing({ team });
14
14
  standing.calculateStanding(this.matches);
15
15
  return standing;
16
16
  }).sort(Standing.sortFn);
@@ -21,7 +21,7 @@ export class Season {
21
21
  this.standings.length = 0;
22
22
  this.standings.push(...this.calculateStandings());
23
23
  if (this.matches.every((match) => match.isSimulated)) {
24
- this.champion = this.teams.find((team) => team.id === this.standings[0].teamId);
24
+ this.champion = this.standings[0].team;
25
25
  }
26
26
  }
27
27
  }
@@ -1,9 +1,10 @@
1
1
  import { Match } from '../match';
2
+ import { Team } from '../team';
2
3
  interface StandingOpts {
3
- readonly teamId: string;
4
+ readonly team: Team;
4
5
  }
5
6
  export declare class Standing {
6
- readonly teamId: string;
7
+ readonly team: Team;
7
8
  won30: number;
8
9
  won31: number;
9
10
  won32: number;
@@ -20,7 +21,7 @@ export declare class Standing {
20
21
  matchesWon: number;
21
22
  matchesLost: number;
22
23
  totalMatches: number;
23
- constructor({ teamId }: StandingOpts);
24
+ constructor({ team }: StandingOpts);
24
25
  static sortFn(standingA: Standing, standingB: Standing): number;
25
26
  calculateStanding(matches: Match[]): void;
26
27
  }
@@ -1,6 +1,6 @@
1
1
  import { MatchTeam } from '../match';
2
2
  export class Standing {
3
- constructor({ teamId }) {
3
+ constructor({ team }) {
4
4
  this.won30 = 0;
5
5
  this.won31 = 0;
6
6
  this.won32 = 0;
@@ -17,7 +17,7 @@ export class Standing {
17
17
  this.matchesWon = 0;
18
18
  this.matchesLost = 0;
19
19
  this.totalMatches = 0;
20
- this.teamId = teamId;
20
+ this.team = team;
21
21
  }
22
22
  static sortFn(standingA, standingB) {
23
23
  if (standingB.points > standingA.points)
@@ -36,14 +36,14 @@ export class Standing {
36
36
  return 0;
37
37
  }
38
38
  calculateStanding(matches) {
39
- matches = matches.filter(match => match.homeTeam.id === this.teamId || match.awayTeam.id === this.teamId)
39
+ matches = matches.filter(match => match.homeTeam.id === this.team.id || match.awayTeam.id === this.team.id)
40
40
  .filter(match => match.isOver());
41
41
  let teamSide;
42
42
  let otherSide;
43
43
  let teamScore;
44
44
  let otherScore;
45
45
  for (const match of matches) {
46
- if (this.teamId === match.homeTeam.id) {
46
+ if (this.team.id === match.homeTeam.id) {
47
47
  teamSide = MatchTeam.HOME;
48
48
  otherSide = MatchTeam.AWAY;
49
49
  }
@@ -51,7 +51,7 @@ export class Standing {
51
51
  teamSide = MatchTeam.AWAY;
52
52
  otherSide = MatchTeam.HOME;
53
53
  }
54
- if (match.getWinner().id === this.teamId) {
54
+ if (match.getWinner().id === this.team.id) {
55
55
  this[`won3${match.getTeamSets(otherSide)}`]++;
56
56
  }
57
57
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volleyballsimtypes",
3
- "version": "0.0.71",
3
+ "version": "0.0.72",
4
4
  "description": "vbsim types",
5
5
  "main": "./dist/cjs/src/index.js",
6
6
  "module": "./dist/esm/src/index.js",