Fixed - wc queues not being removed from waiting tables + hallUI.js wc clean up
This commit is contained in:
@@ -544,12 +544,15 @@ var GempLotrHallUI = Class.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
var rowstr = "<tr class='queue" + id + "'><td>" + queue.getAttribute("format") + "</td>";
|
var rowstr = "<tr class='queue" + id + "'><td>" + queue.getAttribute("format") + "</td>";
|
||||||
if(isWC) {
|
var startTd = "<td>" + queue.getAttribute("start") + "</td>";
|
||||||
rowstr = "<tr class='wc-queue" + id + "'><td>" + queue.getAttribute("format") + "</td>" +
|
var systemTd = "<td>" + queue.getAttribute("system") + "</td>";
|
||||||
"<td>" + queue.getAttribute("queue") + "</td>" +
|
var playersTd = "<td><div class='prizeHint' title='Queued Players' value='" + queue.getAttribute("playerList") + "'>" + queue.getAttribute("playerCount") + "</div></td>";
|
||||||
"<td>" + queue.getAttribute("start") + "</td>" +
|
var costPrizesTds = "<td align='right'>" + formatPrice(queue.getAttribute("cost")) + "</td><td>" + queue.getAttribute("prizes") + "</td>";
|
||||||
"<td>" + queue.getAttribute("system") + "</td>" +
|
if (isWC) { // assumes that wc queue is always constructed
|
||||||
"<td><div class='prizeHint' title='Queued Players' value='" + queue.getAttribute("playerList") + "'>" + queue.getAttribute("playerCount") + "</div></td>" +
|
rowstr += "<td>" + queue.getAttribute("queue") + "</td>" +
|
||||||
|
startTd +
|
||||||
|
systemTd +
|
||||||
|
playersTd +
|
||||||
"</tr>";
|
"</tr>";
|
||||||
} else if (type.includes("Sealed") || type.includes("Draft")) {
|
} else if (type.includes("Sealed") || type.includes("Draft")) {
|
||||||
// No prizes and cost displayed for limited games
|
// No prizes and cost displayed for limited games
|
||||||
@@ -559,19 +562,18 @@ var GempLotrHallUI = Class.extend({
|
|||||||
rowstr += " class='draftFormatInfo' draftCode='"+ queue.getAttribute("draftCode") + "'";
|
rowstr += " class='draftFormatInfo' draftCode='"+ queue.getAttribute("draftCode") + "'";
|
||||||
}
|
}
|
||||||
rowstr += ">" + queue.getAttribute("queue") + "</div></td>" +
|
rowstr += ">" + queue.getAttribute("queue") + "</div></td>" +
|
||||||
"<td>" + queue.getAttribute("start") + "</td>" +
|
startTd +
|
||||||
"<td>" + queue.getAttribute("system") + "</td>" +
|
systemTd +
|
||||||
"<td><div class='prizeHint' title='Queued Players' value='" + queue.getAttribute("playerList") + "'>" + queue.getAttribute("playerCount") + "</div></td>" +
|
playersTd +
|
||||||
"</tr>";
|
"</tr>";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
rowstr += "<td>" + queue.getAttribute("collection") + "</td>";
|
rowstr += "<td>" + queue.getAttribute("collection") + "</td>" +
|
||||||
rowstr += "<td>" + queue.getAttribute("queue") + "</td>" +
|
"<td>" + queue.getAttribute("queue") + "</td>" +
|
||||||
"<td>" + queue.getAttribute("start") + "</td>" +
|
startTd +
|
||||||
"<td>" + queue.getAttribute("system") + "</td>" +
|
systemTd +
|
||||||
"<td><div class='prizeHint' title='Queued Players' value='" + queue.getAttribute("playerList") + "'>" + queue.getAttribute("playerCount") + "</div></td>" +
|
playersTd +
|
||||||
"<td align='right'>" + formatPrice(queue.getAttribute("cost")) + "</td>" +
|
costPrizesTds +
|
||||||
"<td>" + queue.getAttribute("prizes") + "</td>" +
|
|
||||||
"</tr>";
|
"</tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -581,7 +583,13 @@ var GempLotrHallUI = Class.extend({
|
|||||||
// Row for tournament queue waiting table
|
// Row for tournament queue waiting table
|
||||||
var tablesRow = $("<tr class='table" + id + "'></tr>");
|
var tablesRow = $("<tr class='table" + id + "'></tr>");
|
||||||
tablesRow.append("<td>" + queue.getAttribute("format") + "</td>");
|
tablesRow.append("<td>" + queue.getAttribute("format") + "</td>");
|
||||||
let htmlTd = "<td> Tournament - " + type + " - <div style='display:inline'";
|
let htmlTd = "<td> ";
|
||||||
|
if (isWC) {
|
||||||
|
htmlTd += "WC";
|
||||||
|
} else {
|
||||||
|
htmlTd += "Tournament"
|
||||||
|
}
|
||||||
|
htmlTd += " - " + type + " - <div style='display:inline'"
|
||||||
if (type.includes("Table") && queue.hasAttribute("draftCode")) {
|
if (type.includes("Table") && queue.hasAttribute("draftCode")) {
|
||||||
htmlTd += " class='draftFormatInfo' draftCode='"+ queue.getAttribute("draftCode") + "'";
|
htmlTd += " class='draftFormatInfo' draftCode='"+ queue.getAttribute("draftCode") + "'";
|
||||||
}
|
}
|
||||||
@@ -609,17 +617,12 @@ var GempLotrHallUI = Class.extend({
|
|||||||
.append(row);
|
.append(row);
|
||||||
}
|
}
|
||||||
// Display queues with waiting players also as waiting tables
|
// Display queues with waiting players also as waiting tables
|
||||||
if (queue.getAttribute("playerCount") != 0) {
|
if (queue.getAttribute("playerCount") != 0 || isWC) {
|
||||||
$("table.waitingTables", this.tablesDiv)
|
$("table.waitingTables", this.tablesDiv)
|
||||||
.append(tablesRow);
|
.append(tablesRow);
|
||||||
}
|
}
|
||||||
} else if (action == "update") {
|
} else if (action == "update") {
|
||||||
if(isWC) {
|
|
||||||
$(".wc-queue" + id, this.tablesDiv).replaceWith(row);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$(".queue" + id, this.tablesDiv).replaceWith(row);
|
$(".queue" + id, this.tablesDiv).replaceWith(row);
|
||||||
}
|
|
||||||
// Display queues with waiting players also as waiting tables
|
// Display queues with waiting players also as waiting tables
|
||||||
if (queue.getAttribute("playerCount") != 0) {
|
if (queue.getAttribute("playerCount") != 0) {
|
||||||
var existingRow = $(".table" + id, this.tablesDiv);
|
var existingRow = $(".table" + id, this.tablesDiv);
|
||||||
@@ -636,22 +639,12 @@ var GempLotrHallUI = Class.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isWC) {
|
|
||||||
this.animateRowUpdate(".wc-queue" + id);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.animateRowUpdate(".queue" + id);
|
this.animateRowUpdate(".queue" + id);
|
||||||
}
|
|
||||||
|
|
||||||
} else if (action == "remove") {
|
} else if (action == "remove") {
|
||||||
if(isWC) {
|
|
||||||
$(".wc-queue" + id, this.tablesDiv).remove();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$(".queue" + id, this.tablesDiv).remove();
|
$(".queue" + id, this.tablesDiv).remove();
|
||||||
// Remove tournaments displayed as tables
|
// Remove tournaments displayed as tables
|
||||||
$(".table" + id, this.tablesDiv).remove();
|
$(".table" + id, this.tablesDiv).remove();
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -667,7 +660,7 @@ var GempLotrHallUI = Class.extend({
|
|||||||
for (var i = 0; i < tournaments.length; i++) {
|
for (var i = 0; i < tournaments.length; i++) {
|
||||||
var tournament = tournaments[i];
|
var tournament = tournaments[i];
|
||||||
var id = tournament.getAttribute("id");
|
var id = tournament.getAttribute("id");
|
||||||
var isWC = id.includes("wc");
|
var isWC = id.toLowerCase().includes("wc");
|
||||||
var action = tournament.getAttribute("action");
|
var action = tournament.getAttribute("action");
|
||||||
var type = tournament.getAttribute("type");
|
var type = tournament.getAttribute("type");
|
||||||
if(type !== null)
|
if(type !== null)
|
||||||
@@ -794,46 +787,35 @@ var GempLotrHallUI = Class.extend({
|
|||||||
var rowstr = "";
|
var rowstr = "";
|
||||||
|
|
||||||
if(isWC) {
|
if(isWC) {
|
||||||
rowstr = $("<tr class='wc-tournament" + id + "'><td>" + tournament.getAttribute("format") + "</td>" +
|
rowstr += "<tr class='tournament" + id + "'><td>" + tournament.getAttribute("format") + "</td>";
|
||||||
"<td>" + tournament.getAttribute("name") + "</td>" +
|
} else {
|
||||||
"<td>" + tournament.getAttribute("system") + "</td>" +
|
rowstr += "<tr class='tournament" + id + "'><td>" + tournament.getAttribute("format") + "</td>";
|
||||||
"<td>" + tournament.getAttribute("stage") + "</td>" +
|
|
||||||
"<td>" + tournament.getAttribute("round") + "</td>" +
|
|
||||||
"<td><div class='prizeHint' title='Competing Players' value='" + tournament.getAttribute("playerList") + "<br><br>* = abandoned'>" + tournament.getAttribute("playerCount") + "</div></td>" +
|
|
||||||
"</tr>");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
rowhtml = "<tr class='tournament" + id + "'><td>" + tournament.getAttribute("format") + "</td>";
|
|
||||||
if(type === "sealed") {
|
if(type === "sealed") {
|
||||||
rowhtml += "<td>Sealed</td>";
|
rowstr += "<td>Sealed</td>";
|
||||||
}
|
}
|
||||||
else if (type === "solodraft") {
|
else if (type === "solodraft") {
|
||||||
rowhtml += "<td>Solo Draft</td>";
|
rowstr += "<td>Solo Draft</td>";
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (type === "table_solodraft") {
|
else if (type === "table_solodraft") {
|
||||||
rowhtml += "<td>Solo Table Draft</td>";
|
rowstr += "<td>Solo Table Draft</td>";
|
||||||
}
|
}
|
||||||
else if (type === "table_draft") {
|
else if (type === "table_draft") {
|
||||||
rowhtml += "<td>Table Draft</td>";
|
rowstr += "<td>Table Draft</td>";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rowhtml += "<td>" + tournament.getAttribute("collection") + "</td>";
|
rowstr += "<td>" + tournament.getAttribute("collection") + "</td>";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
rowhtml += "<td>" + tournament.getAttribute("name") + "</td>" +
|
rowstr += "<td>" + tournament.getAttribute("name") + "</td>" +
|
||||||
"<td>" + tournament.getAttribute("system") + "</td>";
|
"<td>" + tournament.getAttribute("system") + "</td>";
|
||||||
if (tournament.hasAttribute("timeRemaining")) {
|
if (tournament.hasAttribute("timeRemaining")) {
|
||||||
rowhtml += "<td>" + tournament.getAttribute("stage") + " - " + tournament.getAttribute("timeRemaining") + "</td>";
|
rowstr += "<td>" + tournament.getAttribute("stage") + " - " + tournament.getAttribute("timeRemaining") + "</td>";
|
||||||
} else {
|
} else {
|
||||||
rowhtml += "<td>" + tournament.getAttribute("stage") + "</td>";
|
rowstr += "<td>" + tournament.getAttribute("stage") + "</td>";
|
||||||
}
|
|
||||||
rowhtml += "<td>" + tournament.getAttribute("round") + "</td>" +
|
|
||||||
"<td><div class='prizeHint' title='Competing Players' value='" + tournament.getAttribute("playerList") + "<br><br>* = abandoned'>" + tournament.getAttribute("playerCount") + "</div></td>" +
|
|
||||||
"</tr>";
|
|
||||||
|
|
||||||
rowstr = $(rowhtml);
|
|
||||||
}
|
}
|
||||||
|
rowstr += "<td>" + tournament.getAttribute("round") + "</td>" +
|
||||||
|
"<td><div class='prizeHint' title='Competing Players' value='" + tournament.getAttribute("playerList") + "<br><br>* = abandoned'>" + tournament.getAttribute("playerCount") + "</div></td></tr>";
|
||||||
|
|
||||||
var row = $(rowstr);
|
var row = $(rowstr);
|
||||||
row.append(actionsField);
|
row.append(actionsField);
|
||||||
@@ -868,16 +850,17 @@ var GempLotrHallUI = Class.extend({
|
|||||||
tablesRow.addClass("played"); // red highlight
|
tablesRow.addClass("played"); // red highlight
|
||||||
|
|
||||||
if (action == "add") {
|
if (action == "add") {
|
||||||
if(isWC) {
|
if (isWC) {
|
||||||
$("table.wc-events", this.tablesDiv)
|
$("table.wc-events", this.tablesDiv)
|
||||||
.append(row);
|
.append(row);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$("table.tournaments", this.tablesDiv)
|
$("table.tournaments", this.tablesDiv)
|
||||||
.append(row);
|
.append(row);
|
||||||
|
}
|
||||||
// Display running tournaments also as playing tables
|
// Display running tournaments also as playing tables
|
||||||
$("table.playingTables", this.tablesDiv)
|
$("table.playingTables", this.tablesDiv)
|
||||||
.append(tablesRow)
|
.append(tablesRow)
|
||||||
|
|
||||||
if (joined == "true") {
|
if (joined == "true") {
|
||||||
// Open draft window
|
// Open draft window
|
||||||
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"))
|
||||||
@@ -889,16 +872,10 @@ var GempLotrHallUI = Class.extend({
|
|||||||
var tourneyId = tournament.getAttribute("id");
|
var tourneyId = tournament.getAttribute("id");
|
||||||
window.open("/gemp-lotr/soloDraft.html?eventId=" + tourneyId, '_blank');
|
window.open("/gemp-lotr/soloDraft.html?eventId=" + tourneyId, '_blank');
|
||||||
this.PlaySound("gamestart");
|
this.PlaySound("gamestart");
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (action == "update") {
|
} else if (action == "update") {
|
||||||
if(isWC) {
|
|
||||||
$(".wc-tournament" + id, this.tablesDiv).replaceWith(row);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$(".tournament" + id, this.tablesDiv).replaceWith(row);
|
$(".tournament" + id, this.tablesDiv).replaceWith(row);
|
||||||
|
|
||||||
// Display tournaments also as playing tables
|
// Display tournaments also as playing tables
|
||||||
@@ -912,20 +889,13 @@ var GempLotrHallUI = Class.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
this.animateRowUpdate(".tournament" + id);
|
this.animateRowUpdate(".tournament" + id);
|
||||||
} else if (action == "remove") {
|
} else if (action == "remove") {
|
||||||
if(isWC) {
|
|
||||||
$(".wc-tournament" + id, this.tablesDiv).remove();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$(".tournament" + id, this.tablesDiv).remove();
|
$(".tournament" + id, this.tablesDiv).remove();
|
||||||
// Remove tournaments displayed as tables
|
// Remove tournaments displayed as tables
|
||||||
$(".table" + id, this.tablesDiv).remove();
|
$(".table" + id, this.tablesDiv).remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if($('.wc-events tr').length <= 1) {
|
if($('.wc-events tr').length <= 1) {
|
||||||
$('#wcEventsHeader').hide();
|
$('#wcEventsHeader').hide();
|
||||||
|
|||||||
Reference in New Issue
Block a user