volleyballsimtypes 0.0.379 → 0.0.380

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.
@@ -30,11 +30,18 @@ class Qualifier {
30
30
  const thirdPlace = this.matches.find(m => m.stage === stage_1.Stage.THIRD_PLACE);
31
31
  if (final == null || thirdPlace == null)
32
32
  return;
33
+ // Only derive the podium once both deciders are actually played. Building it while either is still
34
+ // pending would call getWinner() on an unfinished match and throw UNFINISHED_MATCH, which crashes
35
+ // every consumer that loads in-progress qualifiers (the scheduler's progress check, the API, etc.).
36
+ if (!final.match.isOver() || !thirdPlace.match.isOver())
37
+ return;
38
+ const finalWinner = final.match.getWinner();
39
+ const thirdWinner = thirdPlace.match.getWinner();
33
40
  this.podium = [
34
- final.match.getWinner(),
35
- final.match.getWinner().id === final.match.homeTeam.id ? final.match.awayTeam : final.match.homeTeam,
36
- thirdPlace.match.getWinner(),
37
- thirdPlace.match.getWinner().id === thirdPlace.match.homeTeam.id ? thirdPlace.match.awayTeam : thirdPlace.match.homeTeam
41
+ finalWinner,
42
+ finalWinner.id === final.match.homeTeam.id ? final.match.awayTeam : final.match.homeTeam,
43
+ thirdWinner,
44
+ thirdWinner.id === thirdPlace.match.homeTeam.id ? thirdPlace.match.awayTeam : thirdPlace.match.homeTeam
38
45
  ];
39
46
  }
40
47
  static sortMatchesFn(m1, m2) {
@@ -27,11 +27,18 @@ export class Qualifier {
27
27
  const thirdPlace = this.matches.find(m => m.stage === Stage.THIRD_PLACE);
28
28
  if (final == null || thirdPlace == null)
29
29
  return;
30
+ // Only derive the podium once both deciders are actually played. Building it while either is still
31
+ // pending would call getWinner() on an unfinished match and throw UNFINISHED_MATCH, which crashes
32
+ // every consumer that loads in-progress qualifiers (the scheduler's progress check, the API, etc.).
33
+ if (!final.match.isOver() || !thirdPlace.match.isOver())
34
+ return;
35
+ const finalWinner = final.match.getWinner();
36
+ const thirdWinner = thirdPlace.match.getWinner();
30
37
  this.podium = [
31
- final.match.getWinner(),
32
- final.match.getWinner().id === final.match.homeTeam.id ? final.match.awayTeam : final.match.homeTeam,
33
- thirdPlace.match.getWinner(),
34
- thirdPlace.match.getWinner().id === thirdPlace.match.homeTeam.id ? thirdPlace.match.awayTeam : thirdPlace.match.homeTeam
38
+ finalWinner,
39
+ finalWinner.id === final.match.homeTeam.id ? final.match.awayTeam : final.match.homeTeam,
40
+ thirdWinner,
41
+ thirdWinner.id === thirdPlace.match.homeTeam.id ? thirdPlace.match.awayTeam : thirdPlace.match.homeTeam
35
42
  ];
36
43
  }
37
44
  static sortMatchesFn(m1, m2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volleyballsimtypes",
3
- "version": "0.0.379",
3
+ "version": "0.0.380",
4
4
  "description": "vbsim types",
5
5
  "main": "./dist/cjs/src/index.js",
6
6
  "module": "./dist/esm/src/index.js",