class Team {
constructor(player_1, player_2) {
this.player_1 = player_1;
this.player_2 = player_2;
}
print() {
console.log(this.player_1 + " and " + this.player_2);
}
render() {
return `
${this.player_1} | ${this.player_2} | `;
}
}
class Game {
constructor(court, team_1, team_2) {
this.court_id = court.id;
this.court_status = court.status;
this.team_1 = team_1;
this.team_2 = team_2;
}
print() {
let team_1 = this.team_1.player_1 + " and " + this.team_1.player_2;
let team_2 = this.team_2.player_1 + " and " + this.team_2.player_2;
console.log(team_1 + " is playing against " + team_2);
}
render() {
let type = this.team_1.player_1 === "RESERVED" ? `class="is-danger is-light"` : ``;
return `| ${this.court_id + 1} | ${this.team_1.render()}${this.team_2.render()}
`;
}
}
export class Round {
constructor(number, courts) {
this.number = number;
this.courts = courts;
}
render() {
let output = ` Round ${this.number}
| Court | Team 1 | Team 2 |
`;
let team = new Team("---", "---");
for (const court of this.courts ) {
let game = new Game(court, team, team);
output += game.render()
}
output += "
";
return output;
}
}