Tournaments with player(s) waiting are now displayed with waiting tables

This commit is contained in:
jakub.salavec
2025-02-18 14:02:59 +01:00
parent b2b6a6ebe6
commit 58536e0de3
2 changed files with 52 additions and 11 deletions

View File

@@ -480,7 +480,6 @@ var GempLotrHallUI = Class.extend({
}
else if (type === "solodraft") {
rowstr += "<td>Solo Draft</td>";
}
else {
rowstr += "<td>" + queue.getAttribute("collection") + "</td>";
@@ -497,6 +496,24 @@ var GempLotrHallUI = Class.extend({
var row = $(rowstr);
row.append(actionsField);
// Row for tournament queue table
var tablesRow = $("<tr class='table" + id + "'></tr>");
tablesRow.append("<td>" + queue.getAttribute("format") + "</td>");
var type = queue.getAttribute("type");
if(type !== null)
type = type.toLowerCase();
if(type === "sealed") {
type = "Sealed";
}
else if (type === "solodraft") {
type = "Solo Draft";
}
tablesRow.append("<td> Tournament - " + type + " - " + queue.getAttribute("queue") + "</td>");
tablesRow.append("<td>" + queue.getAttribute("start") + "</td>");
tablesRow.append("<td>" + queue.getAttribute("playerList") + "</td>");
var actionsFieldClone = actionsField.clone(true);
tablesRow.append(actionsFieldClone);
if (action == "add") {
if(isWC) {
$("table.wc-queues", this.tablesDiv)
@@ -505,6 +522,11 @@ var GempLotrHallUI = Class.extend({
else {
$("table.queues", this.tablesDiv)
.append(row);
// Display 2-man queues with 1 player joined as tables
if (queue.getAttribute("playerCount") != 0) {
$("table.waitingTables", this.tablesDiv)
.append(tablesRow);
}
}
} else if (action == "update") {
if(isWC) {
@@ -512,6 +534,21 @@ var GempLotrHallUI = Class.extend({
}
else {
$(".queue" + id, this.tablesDiv).replaceWith(row);
// Display 2-man queues with 1 player joined as tables
if (queue.getAttribute("playerCount") != 0) {
var existingRow = $(".table" + id, this.tablesDiv);
if (existingRow.length > 0) {
// If the row exists, replace it
existingRow.replaceWith(tablesRow);
} else {
// If the row does not exist, append it
$("table.waitingTables", this.tablesDiv).append(tablesRow);
}
} else if (queue.getAttribute("playerCount") == 0) {
// Remove tournaments displayed as tables
$(".table" + id, this.tablesDiv).remove();
}
}
}
@@ -529,6 +566,8 @@ var GempLotrHallUI = Class.extend({
}
else {
$(".queue" + id, this.tablesDiv).remove();
// Remove tournaments displayed as tables
$(".table" + id, this.tablesDiv).remove();
}
}

View File

@@ -146,7 +146,7 @@ public class TournamentService {
sealedParams.tournamentId = prefix;
sealedParams.name = queueName;
sealedParams.cost = 0;
sealedParams.minimumPlayers = 2;
sealedParams.minimumPlayers = 4;
sealedParams.playoff = Tournament.PairingType.SWISS_3;
sealedParams.prizes = Tournament.PrizeType.DAILY;
@@ -172,7 +172,7 @@ public class TournamentService {
soloDraftParams.tournamentId = prefix;
soloDraftParams.name = queueName;
soloDraftParams.cost = 0;
soloDraftParams.minimumPlayers = 2;
soloDraftParams.minimumPlayers = 4;
soloDraftParams.playoff = Tournament.PairingType.SWISS_3;
soloDraftParams.prizes = Tournament.PrizeType.DAILY;
@@ -187,6 +187,11 @@ public class TournamentService {
clearCache();
_tournamentQueues.clear();
addImmediateRecurringSealed("fotr_sealed_queue", "FotR Sealed", "fotrSealedQueue-", "single_fotr_block_sealed");
addImmediateRecurringSealed("movie_sealed_queue", "Movie Sealed", "movieSealedQueue-", "single_movie_sealed");
addImmediateRecurringDraft("fotr_draft_queue", "FotR Draft", "fotrDraftQueue-", "fotr_draft");
addImmediateRecurringDraft("ttt_draft_queue", "TTT Draft", "tttDraftQueue-", "ttt_draft");
addImmediateRecurringQueue("fotr_queue", "Fellowship Block", "fotrQueue-", "fotr_block");
addImmediateRecurringQueue("pc_fotr_queue", "PC-Fellowship", "pcfotrQueue-", "pc_fotr_block");
addImmediateRecurringQueue("ts_queue", "Towers Standard", "tsQueue-", "towers_standard");
@@ -195,9 +200,6 @@ public class TournamentService {
addImmediateRecurringQueue("expanded_queue", "Expanded", "expandedQueue-", "expanded");
addImmediateRecurringQueue("pc_expanded_queue", "PC-Expanded", "pcexpandedQueue-", "pc_expanded");
addImmediateRecurringSealed("sealed_queue", "FotR Sealed", "sealedQueue-", "single_fotr_block_sealed");
addImmediateRecurringDraft("draft_queue", "FotR Draft", "draftQueue-", "fotr_draft");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
@@ -207,11 +209,11 @@ public class TournamentService {
addRecurringScheduledQueue("movie_daily_eu", "Daily Gondor Movie Block", "2013-01-16 19:30:00", "movieDailyEu-", "movie");
addRecurringScheduledQueue("movie_daily_us", "Daily Rohan Movie Block", "2013-01-17 00:30:00", "movieDailyUs-", "movie");
addRecurringScheduledDraft("fotr_draft_daily_eu", "Daily Gondor Fellowship Draft", "2013-01-16 19:30:00", "fotrDraftDailyEu-", "fotr_draft");
addRecurringScheduledDraft("fotr_draft_daily_us", "Daily Rohan Fellowship Draft", "2013-01-17 00:30:00", "fotrDraftDailyUS-", "fotr_draft");
addRecurringScheduledSealed("movie_sealed_daily_eu", "Daily Gondor Movie Sealed", "2013-01-15 19:30:00", "movieSealedDailyEu-", "single_movie_sealed");
addRecurringScheduledSealed("movie_sealed_daily_us", "Daily Rohan Movie Sealed", "2013-01-16 00:30:00", "movieSealedDailyUs-", "single_movie_sealed");
// addRecurringScheduledDraft("fotr_draft_daily_eu", "Daily Gondor Fellowship Draft", "2013-01-16 19:30:00", "fotrDraftDailyEu-", "fotr_draft");
// addRecurringScheduledDraft("fotr_draft_daily_us", "Daily Rohan Fellowship Draft", "2013-01-17 00:30:00", "fotrDraftDailyUS-", "fotr_draft");
//
// addRecurringScheduledSealed("movie_sealed_daily_eu", "Daily Gondor Movie Sealed", "2013-01-15 19:30:00", "movieSealedDailyEu-", "single_movie_sealed");
// addRecurringScheduledSealed("movie_sealed_daily_us", "Daily Rohan Movie Sealed", "2013-01-16 00:30:00", "movieSealedDailyUs-", "single_movie_sealed");
} catch (DateTimeParseException exp) {
// Ignore, can't happen