Question regarding to update match game #125
-
Here is the input Tournament data: Sample Tournament Data
{
"participant": [
{
"id": 0,
"tournament_id": 6,
"name": "Team 5"
},
{
"id": 1,
"tournament_id": 6,
"name": "Team 6"
},
{
"id": 2,
"tournament_id": 6,
"name": "Team 7"
},
{
"id": 3,
"tournament_id": 6,
"name": "Team 8"
}
],
"stage": [
{
"id": 0,
"tournament_id": 6,
"name": "Random D9-3",
"type": "double_elimination",
"number": 9,
"settings": {
"size": 4,
"seedOrdering": [
"inner_outer",
"natural"
],
"grandFinal": "single",
"matchesChildCount": 3,
"groupCount": null,
"roundRobinMode": null,
"skipFirstRound": false
}
}
],
"group": [
{
"id": 0,
"stage_id": 0,
"number": 1
},
{
"id": 1,
"stage_id": 0,
"number": 2
},
{
"id": 2,
"stage_id": 0,
"number": 3
}
],
"round": [
{
"id": 0,
"number": 1,
"stage_id": 0,
"group_id": 0
},
{
"id": 1,
"number": 2,
"stage_id": 0,
"group_id": 0
},
{
"id": 2,
"number": 1,
"stage_id": 0,
"group_id": 1
},
{
"id": 3,
"number": 2,
"stage_id": 0,
"group_id": 1
},
{
"id": 4,
"number": 1,
"stage_id": 0,
"group_id": 2
}
],
"match": [
{
"id": 0,
"number": 1,
"stage_id": 0,
"group_id": 0,
"round_id": 0,
"child_count": 3,
"status": 2,
"opponent1": {
"id": 0,
"position": 1
},
"opponent2": {
"id": 3,
"position": 4
}
},
{
"id": 1,
"number": 2,
"stage_id": 0,
"group_id": 0,
"round_id": 0,
"child_count": 3,
"status": 2,
"opponent1": {
"id": 1,
"position": 2
},
"opponent2": {
"id": 2,
"position": 3
}
},
{
"id": 2,
"number": 1,
"stage_id": 0,
"group_id": 0,
"round_id": 1,
"child_count": 3,
"status": 0,
"opponent1": {
"id": null
},
"opponent2": {
"id": null
}
},
{
"id": 3,
"number": 1,
"stage_id": 0,
"group_id": 1,
"round_id": 2,
"child_count": 3,
"status": 0,
"opponent1": {
"id": null,
"position": 1
},
"opponent2": {
"id": null,
"position": 2
}
},
{
"id": 4,
"number": 1,
"stage_id": 0,
"group_id": 1,
"round_id": 3,
"child_count": 3,
"status": 0,
"opponent1": {
"id": null,
"position": 1
},
"opponent2": {
"id": null
}
},
{
"id": 5,
"number": 1,
"stage_id": 0,
"group_id": 2,
"round_id": 4,
"child_count": 3,
"status": 0,
"opponent1": {
"id": null
},
"opponent2": {
"id": null,
"position": 1
}
}
],
"match_game": [
{
"id": 0,
"stage_id": 0,
"parent_id": 0,
"number": 1,
"status": 2,
"opponent1": {
"id": 0
},
"opponent2": {
"id": 3
}
},
{
"id": 1,
"stage_id": 0,
"parent_id": 0,
"number": 2,
"status": 2,
"opponent1": {
"id": 0
},
"opponent2": {
"id": 3
}
},
{
"id": 2,
"stage_id": 0,
"parent_id": 0,
"number": 3,
"status": 2,
"opponent1": {
"id": 0
},
"opponent2": {
"id": 3
}
},
{
"id": 3,
"stage_id": 0,
"parent_id": 1,
"number": 1,
"status": 2,
"opponent1": {
"id": 1
},
"opponent2": {
"id": 2
}
},
{
"id": 4,
"stage_id": 0,
"parent_id": 1,
"number": 2,
"status": 2,
"opponent1": {
"id": 1
},
"opponent2": {
"id": 2
}
},
{
"id": 5,
"stage_id": 0,
"parent_id": 1,
"number": 3,
"status": 2,
"opponent1": {
"id": 1
},
"opponent2": {
"id": 2
}
},
{
"id": 6,
"stage_id": 0,
"parent_id": 2,
"number": 1,
"status": 0,
"opponent1": {
"id": null
},
"opponent2": {
"id": null
}
},
{
"id": 7,
"stage_id": 0,
"parent_id": 2,
"number": 2,
"status": 0,
"opponent1": {
"id": null
},
"opponent2": {
"id": null
}
},
{
"id": 8,
"stage_id": 0,
"parent_id": 2,
"number": 3,
"status": 0,
"opponent1": {
"id": null
},
"opponent2": {
"id": null
}
},
{
"id": 9,
"stage_id": 0,
"parent_id": 3,
"number": 1,
"status": 0,
"opponent1": {
"id": null
},
"opponent2": {
"id": null
}
},
{
"id": 10,
"stage_id": 0,
"parent_id": 3,
"number": 2,
"status": 0,
"opponent1": {
"id": null
},
"opponent2": {
"id": null
}
},
{
"id": 11,
"stage_id": 0,
"parent_id": 3,
"number": 3,
"status": 0,
"opponent1": {
"id": null
},
"opponent2": {
"id": null
}
},
{
"id": 12,
"stage_id": 0,
"parent_id": 4,
"number": 1,
"status": 0,
"opponent1": {
"id": null
},
"opponent2": {
"id": null
}
},
{
"id": 13,
"stage_id": 0,
"parent_id": 4,
"number": 2,
"status": 0,
"opponent1": {
"id": null
},
"opponent2": {
"id": null
}
},
{
"id": 14,
"stage_id": 0,
"parent_id": 4,
"number": 3,
"status": 0,
"opponent1": {
"id": null
},
"opponent2": {
"id": null
}
},
{
"id": 15,
"stage_id": 0,
"parent_id": 5,
"number": 1,
"status": 0,
"opponent1": {
"id": null
},
"opponent2": {
"id": null
}
},
{
"id": 16,
"stage_id": 0,
"parent_id": 5,
"number": 2,
"status": 0,
"opponent1": {
"id": null
},
"opponent2": {
"id": null
}
},
{
"id": 17,
"stage_id": 0,
"parent_id": 5,
"number": 3,
"status": 0,
"opponent1": {
"id": null
},
"opponent2": {
"id": null
}
}
]
} In summary, each match consists of 3 match games. I'm tried to update the match game as below:
await window.bracketsManager.update.matchGame({ parent_id: 0, id: 0, opponent1: { result: "win" }, opponent2: { result: "loss" } }); Initial with the line above, it updates successfully for the match data. (Getting the data via Match (after First Update): [
{
"id": 0,
"number": 1,
"stage_id": 0,
"group_id": 0,
"round_id": 0,
"child_count": 3,
"status": 3,
"opponent1": {
"id": 0,
"position": 1,
"score": 1
},
"opponent2": {
"id": 3,
"position": 4,
"score": 0
}
}
] Match Game (after First Update): {
"id": 0,
"stage_id": 0,
"parent_id": 0,
"number": 1,
"status": 4,
"opponent1": {
"id": 0
},
"opponent2": {
"id": 3
}
} However, when I tried to re-update the same match game as below:
await window.bracketsManager.update.matchGame({ parent_id: 0, id: 0, opponent1: { result: "loss" }, opponent2: { result: "win" } }); Match (after Second Update): {
"id": 0,
"number": 1,
"stage_id": 0,
"group_id": 0,
"round_id": 0,
"child_count": 3,
"status": 4,
"opponent1": {
"id": 0,
"position": 1,
"score": 0,
"result": "loss"
},
"opponent2": {
"id": 3,
"position": 4,
"score": 3,
"result": "win"
}
} Match Game (after Second Update): {
"id": 0,
"stage_id": 0,
"parent_id": 0,
"number": 1,
"status": 4,
"opponent1": {
"id": 0
},
"opponent2": {
"id": 3
}
} The Expected result: Status: 3 (Running), Opponent1: { Score: 0, Result: "loss" }, Opponent2: { Score: 1, Result: "win" } Think the update for the parent match is failed. And also I think when after the First Update submission (which leads to match status: 3), when I update the match game, it leads the match result calculate wrongly. It's hard to explain in words, so I upload the sample videos: DEMO - Google Chrome 2022-03-24 22-37-10.zip For code wise, when the button is clicked, I will prepare those match games to be updated and next executed: // Logic prepare matchGames to be updated
let matchGamesToBeUpdated = [{ parent_id: ?, id: ?, opponent1: { result: ? }, opponent2: { result: ? } }, /* Following */]
matchGamesToBeUpdated.map(async (matchGame) => {
await window.bracketsManager.update.matchGame(matchGame);
}); Question: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
It seems like a bug. But you are not updating match games right: you shouldn't give an You must give either just an Maybe it will fix your issue. |
Beta Was this translation helpful? Give feedback.
-
This should be fixed if you use I also released a new version of the viewer: |
Beta Was this translation helpful? Give feedback.
This should be fixed if you use
[email protected]
.I also released a new version of the viewer:
[email protected]
.