diff --git a/gemp-lotr/gemp-lotr-web-server/src/main/java/com/gempukku/lotro/server/ServerResource.java b/gemp-lotr/gemp-lotr-web-server/src/main/java/com/gempukku/lotro/server/ServerResource.java index a4c86143c..90737ac41 100644 --- a/gemp-lotr/gemp-lotr-web-server/src/main/java/com/gempukku/lotro/server/ServerResource.java +++ b/gemp-lotr/gemp-lotr-web-server/src/main/java/com/gempukku/lotro/server/ServerResource.java @@ -255,6 +255,8 @@ public class ServerResource extends AbstractResource { Element stats = doc.createElement("stats"); stats.setAttribute("activePlayers", String.valueOf(activePlayers)); stats.setAttribute("gamesCount", String.valueOf(gamesCount)); + stats.setAttribute("start", format.format(new Date(from))); + stats.setAttribute("end", format.format(new Date(from + duration - 1))); for (GameHistoryStatistics.FormatStat formatStat : gameHistoryStatistics.getFormatStats()) { Element formatStatElem = doc.createElement("formatStat"); formatStatElem.setAttribute("format", formatStat.getFormat()); diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html index c7aa637c2..54ae50b5d 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html @@ -184,6 +184,7 @@ + @@ -231,11 +232,11 @@ var infoDialog = $("
") .dialog({ - autoOpen:false, - closeOnEscape:true, - resizable:false, - title:"Card information" - }); + autoOpen:false, + closeOnEscape:true, + resizable:false, + title:"Card information" + }); $("body").click( function (event) { @@ -312,6 +313,7 @@
  • Manual
  • Format Rules
  • Contribute
  • +
  • Stats
  • diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/stats.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/stats.html new file mode 100644 index 000000000..cba5d8296 --- /dev/null +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/stats.html @@ -0,0 +1,10 @@ + +All times are GMT based. +
    +
    \ No newline at end of file diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-009/statsUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-009/statsUi.js new file mode 100644 index 000000000..5fb2d2abd --- /dev/null +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-009/statsUi.js @@ -0,0 +1,66 @@ +var StatsUI = Class.extend({ + communication:null, + formatDialog:null, + + init:function (url) { + this.communication = new GempLotrCommunication(url, + function (xhr, ajaxOptions, thrownError) { + }); + + + var now = new Date(); + var nowStr = now.getFullYear() + "-" + (1 + now.getMonth()) + "-" + now.getDate(); + + $(".statsParameters").append("Start date: "); + $(".statsParameters").append(" period: "); + $(".statsParameters").append(" "); + + var that = this; + + $(".getStats", $(".statsParameters")).click( + function () { + var startDay = $(".startDay", $(".statsParameters")).prop("value"); + var period = $("option:selected", $(".period", $(".statsParameters"))).prop("value"); + + that.communication.getStats(startDay, period, that.loadedStats, { + "400":function () { + alert("Invalid parameter entered"); + } + }) + }); + }, + + loadedStats:function (xml) { + var that = this; + log(xml); + var root = xml.documentElement; + if (root.tagName == 'stats') { + $("#stats").html(""); + + var stats = root; + + var activePlayers = stats.getAttribute("activePlayers"); + var gamesCount = stats.getAttribute("gamesCount"); + var start = stats.getAttribute("start"); + var end = stats.getAttribute("end"); + + $("#stats").append("
    Stats for " + start + " - " + end + "
    "); + $("#stats").append("
    Active players: " + activePlayers + "
    "); + $("#stats").append("
    All games count: " + gamesCount + "
    "); + + var formatStats = stats.getElementsByTagName("formatStat"); + if (formatStats.length > 0) { + $("#stats").append("
    Casual games per format
    "); + + var table = $("
    "); + table.append("Format name# of games% of casual"); + for (var i = 0; i < formatStats.length; i++) { + var formatStat = formatStats[i]; + table.append("" + formatStat.getAttribute("format") + "" + formatStat.getAttribute("count") + "" + formatStat.getAttribute("perc") + ""); + } + + $("#stats").append(table); + } + } + } +}); \ No newline at end of file