slashinfty / tournament-organizer

JavaScript library for running tournaments
https://slashinfty.github.io/tournament-organizer/
MIT License
51 stars 18 forks source link

Cannot read properties of undefined (reading 'matches') #18

Closed oleg-darkdev closed 1 year ago

oleg-darkdev commented 1 year ago

Good evening. Thank you for this library, I really hope to use it in organizing tournaments. But I have a problem 😅

Error text

Cannot read properties of undefined (reading 'matches')
TypeError: Cannot read properties of undefined (reading 'matches')
    at file:///d:/vueJs/hackerspace/svelte_site/kit_test/my-app/node_modules/tournament-organizer/dist/Tournament.js:820:95
    at Array.forEach (<anonymous>)
    at Tournament._Tournament_createMatches (file:///d:/vueJs/hackerspace/svelte_site/kit_test/my-app/node_modules/tournament-organizer/dist/Tournament.js:800:21)
    at Tournament.start (file:///d:/vueJs/hackerspace/svelte_site/kit_test/my-app/node_modules/tournament-organizer/dist/Tournament.js:260:93)

My index.js file

import TournamentOrganizer from "tournament-organizer";

const Manager = new TournamentOrganizer();

let yellowElephant = Manager.createTournament("Tourn 1", {
  stageOne: {
    format: "swiss",
    consolation: true,
    rounds: 0,
  },
  sorting: "ascending",
});

yellowElephant.createPlayer("taras", 1);
yellowElephant.createPlayer("volat", 2);
yellowElephant.createPlayer("brest", 3);
yellowElephant.createPlayer("ibragim", 4);

yellowElephant.start();
console.log(yellowElephant);
slashinfty commented 1 year ago

Player ID values are required to be of type string (https://github.com/slashinfty/tournament-organizer/blob/main/src/interfaces/PlayerValues.ts#L2).