Added tournaments being visible in 'Playing Tables' section to all players

This commit is contained in:
jakub.salavec
2025-04-14 14:05:17 +02:00
parent 62334bb638
commit 3c5fe5d7ce

View File

@@ -858,10 +858,11 @@ var GempLotrHallUI = Class.extend({
else { else {
$("table.tournaments", this.tablesDiv) $("table.tournaments", this.tablesDiv)
.append(row); .append(row);
// Display running tournaments also as playing tables
$("table.playingTables", this.tablesDiv)
.append(tablesRow)
if (joined == "true") { if (joined == "true") {
// Display joined tournaments also as playing tables // Open draft window
$("table.playingTables", this.tablesDiv)
.append(tablesRow)
if ((type === "table_solodraft" && (stage === "deck-building" || stage === "registering decks" || stage === "awaiting kickoff")) if ((type === "table_solodraft" && (stage === "deck-building" || stage === "registering decks" || stage === "awaiting kickoff"))
|| (type === "table_draft" && stage === "drafting")) { || (type === "table_draft" && stage === "drafting")) {
var tourneyId = tournament.getAttribute("id"); var tourneyId = tournament.getAttribute("id");
@@ -883,19 +884,14 @@ var GempLotrHallUI = Class.extend({
else { else {
$(".tournament" + id, this.tablesDiv).replaceWith(row); $(".tournament" + id, this.tablesDiv).replaceWith(row);
// Display joined tournaments also as playing tables // Display tournaments also as playing tables
if (joined == "true") { var existingRow = $(".table" + id, this.tablesDiv);
var existingRow = $(".table" + id, this.tablesDiv); if (existingRow.length > 0) {
if (existingRow.length > 0) { // If the row exists, replace it
// If the row exists, replace it existingRow.replaceWith(tablesRow);
existingRow.replaceWith(tablesRow); } else {
} else { // If the row does not exist, append it
// If the row does not exist, append it $("table.playingTables", this.tablesDiv).append(tablesRow);
$("table.playingTables", this.tablesDiv).append(tablesRow);
}
} else if (joined == "false") {
// Remove tournament displayed as playing table
$(".table" + id, this.tablesDiv).remove();
} }
} }