Modified - past tournaments page, order reversed, 0 games played tournaments cut, details directly below chosen tournament
This commit is contained in:
@@ -145,7 +145,7 @@ public class TournamentRequestHandler extends LotroServerRequestHandler implemen
|
|||||||
Document doc = documentBuilder.newDocument();
|
Document doc = documentBuilder.newDocument();
|
||||||
Element tournaments = doc.createElement("tournaments");
|
Element tournaments = doc.createElement("tournaments");
|
||||||
|
|
||||||
for (Tournament tournament : _tournamentService.getOldTournaments(ZonedDateTime.now().minus(RecentTournamentDuration))) {
|
for (Tournament tournament : _tournamentService.getOldTournaments(ZonedDateTime.now().minus(RecentTournamentDuration)).reversed()) {
|
||||||
Element tournamentElem = doc.createElement("tournament");
|
Element tournamentElem = doc.createElement("tournament");
|
||||||
|
|
||||||
tournamentElem.setAttribute("id", tournament.getTournamentId());
|
tournamentElem.setAttribute("id", tournament.getTournamentId());
|
||||||
@@ -155,6 +155,10 @@ public class TournamentRequestHandler extends LotroServerRequestHandler implemen
|
|||||||
tournamentElem.setAttribute("round", String.valueOf(tournament.getCurrentRound()));
|
tournamentElem.setAttribute("round", String.valueOf(tournament.getCurrentRound()));
|
||||||
tournamentElem.setAttribute("stage", tournament.getTournamentStage().getHumanReadable());
|
tournamentElem.setAttribute("stage", tournament.getTournamentStage().getHumanReadable());
|
||||||
|
|
||||||
|
if (tournament.getTournamentStage().equals(Tournament.Stage.FINISHED) && tournament.getCurrentRound() == 0) {
|
||||||
|
// do NOT include past tournaments with 0 games played (for example draft of one player against bots)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
tournaments.appendChild(tournamentElem);
|
tournaments.appendChild(tournamentElem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,13 +35,11 @@ var TournamentResultsUI = Class.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
loadedTournament:function (xml) {
|
loadedTournament:function (xml, targetDiv) {
|
||||||
var that = this;
|
var that = this;
|
||||||
log(xml);
|
log(xml);
|
||||||
var root = xml.documentElement;
|
var root = xml.documentElement;
|
||||||
if (root.tagName == 'tournament') {
|
if (root.tagName == 'tournament') {
|
||||||
$("#tournamentExtraInfo").html("");
|
|
||||||
|
|
||||||
var tournament = root;
|
var tournament = root;
|
||||||
|
|
||||||
var tournamentId = tournament.getAttribute("id");
|
var tournamentId = tournament.getAttribute("id");
|
||||||
@@ -51,16 +49,16 @@ var TournamentResultsUI = Class.extend({
|
|||||||
var tournamentRound = tournament.getAttribute("round");
|
var tournamentRound = tournament.getAttribute("round");
|
||||||
var tournamentStage = tournament.getAttribute("stage");
|
var tournamentStage = tournament.getAttribute("stage");
|
||||||
|
|
||||||
$("#tournamentExtraInfo").append("<div class='tournamentName'>" + tournamentName + "</div>");
|
targetDiv.append("<div class='tournamentFormat'><b>Format:</b> " + tournamentFormat + "</div>");
|
||||||
|
targetDiv.append("<div class='tournamentCollection'><b>Collection:</b> " + tournamentCollection + "</div>");
|
||||||
$("#tournamentExtraInfo").append("<div class='tournamentFormat'><b>Format:</b> " + tournamentFormat + "</div>");
|
|
||||||
$("#tournamentExtraInfo").append("<div class='tournamentCollection'><b>Collection:</b> " + tournamentCollection + "</div>");
|
|
||||||
if (tournamentStage == "Playing games")
|
if (tournamentStage == "Playing games")
|
||||||
$("#tournamentExtraInfo").append("<div class='tournamentRound'><b>Round:</b> " + tournamentRound + "</div>");
|
targetDiv.append("<div class='tournamentRound'><b>Round:</b> " + tournamentRound + "</div>");
|
||||||
|
|
||||||
var standings = tournament.getElementsByTagName("tournamentStanding");
|
var standings = tournament.getElementsByTagName("tournamentStanding");
|
||||||
if (standings.length > 0)
|
if (standings.length > 0)
|
||||||
$("#tournamentExtraInfo").append(this.createStandingsTable(standings, tournamentId, tournamentStage));
|
targetDiv.append(this.createStandingsTable(standings, tournamentId, tournamentStage));
|
||||||
|
|
||||||
|
targetDiv.show();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -90,22 +88,25 @@ var TournamentResultsUI = Class.extend({
|
|||||||
$("#tournamentResults").append("<div class='tournamentRound'><b>Rounds:</b> " + tournamentRound + "</div>");
|
$("#tournamentResults").append("<div class='tournamentRound'><b>Rounds:</b> " + tournamentRound + "</div>");
|
||||||
|
|
||||||
var detailsBut = $("<button>See details</button>").button();
|
var detailsBut = $("<button>See details</button>").button();
|
||||||
|
$("#tournamentResults").append(detailsBut);
|
||||||
|
|
||||||
|
var extraInfoDiv = $("<div class='tournamentExtraInfo' style='display:none;'></div>");
|
||||||
|
$("#tournamentResults").append(extraInfoDiv);
|
||||||
|
|
||||||
detailsBut.click(
|
detailsBut.click(
|
||||||
(function (id) {
|
(function (id, extraInfoTarget) {
|
||||||
return function () {
|
return function () {
|
||||||
|
var btn = $(this);
|
||||||
that.communication.getTournament(id,
|
that.communication.getTournament(id,
|
||||||
function (xml) {
|
function (xml) {
|
||||||
that.loadedTournament(xml);
|
that.loadedTournament(xml, extraInfoTarget);
|
||||||
|
btn.hide();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
})(tournamentId));
|
})(tournamentId, extraInfoDiv));
|
||||||
$("#tournamentResults").append(detailsBut);
|
|
||||||
}
|
}
|
||||||
if (tournaments.length == 0)
|
if (tournaments.length == 0)
|
||||||
$("#tournamentResults").append("<i>There is no running tournaments at the moment</i>");
|
$("#tournamentResults").append("<i>There is no running tournaments at the moment</i>");
|
||||||
|
|
||||||
$("#tournamentResults").append("<hr />");
|
|
||||||
$("#tournamentResults").append("<div id='tournamentExtraInfo'></div>");
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user