Closed ricardo17coelho closed 12 months ago
I am unsure exactly what you are asking. Could you give me a little more detail or an example of what you want?
Hi @slashinfty
No problem. My question is not clear 😅
I'm think a lit bit about the case:
https://slashinfty.github.io/tournament-organizer/classes/Tournament.html#enterResult
normally i don't add the Number of wins for player one/two
and the Number of draws
but u add the scoreboard of the match.
Like:Result: Player 2 wins the match 3-2
If the score is added to the match, then the results can be added to the standings to display it as well ( like goals difference, how many goals scored, how many conceded )
My question is also based on this, that i'm trying to build with this (amazing) package ( see the values on the table: GF, GA, GD):
The matches
array in the Player
object (see here) has objects for each match, including the number of wins and losses in the match (which, in the case of sports, can be points).
Is this what you're looking for?
No. I'm mean the scoreboard of the match is missing:
Match ID: 01 Player 1 scores 3 goals Player 2 scored 1 goal Result: Player 1 wins 3-1
Match ID: 02 Player 1 scores 2 goals Player 2 scored 2 goal Result: Draw wins 2-2
You can determine the result from the match information.
If you have two players in a match (example):
[
Player {
id: 'LTasmXDtIquJ',
name: 'Player 1',
active: true,
value: 1,
matches: [ [Object] ],
meta: {}
},
Player {
id: 'iwgzRFssrMvC',
name: 'Player 2',
active: true,
value: 2,
matches: [ [Object] ],
meta: {}
}
]
Match {
id: 'N1vjDXxmusjH',
round: 1,
match: 1,
active: false,
bye: false,
player1: { id: 'LTasmXDtIquJ', win: 3, loss: 1, draw: 0 },
player2: { id: 'iwgzRFssrMvC', win: 1, loss: 3, draw: 0 },
path: { win: null, loss: null },
meta: {}
}
You can do:
const winner = match.player1.win > match.player2.win ? 1 : match.player2.win > match.player1.win ? 2 : 0;
console.log(`${winner === 1 ? player1.name : winner === 2 ? player2.name : 'Draw'} wins ${winner === 1 ? match.player1.win : match.player2.win}-${winner === 1 ? match.player2.win : match.player1.win}`);
And get:
Player 1 wins 3-1
I'm sure there's a simpler way to do it, but just demonstrating the possibility.
ahhh. Sorry i had an small mistake. Now i understand it 😅 I'm sorry
HI 👋
As far i understand is not possible to enter the result (scoreboard) to the match. Should this be added to the fn
enterResult()
or is the idea to add this asmeta
? This would be nice on theenterResult()
to be part of thestandings