Skip to content

Commit

Permalink
Merge pull request #29 from pamods/master
Browse files Browse the repository at this point in the history
merged newest stuff
  • Loading branch information
ColaColin committed Dec 17, 2013
2 parents cad0354 + afa81f0 commit 41af5b2
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/main/scala/bootstrap/liftweb/Boot.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class Boot extends Loggable {
Menu.i("Updates") / "updates",
Menu.i("Games") / "listgames",
Menu.i("Players") / PlayerSearchPage.pageName,
Menu(Loc("Ladder", ExtLink("http://spende.gamestown24.de/"), "Ladder")),
Menu.i("Extra") / StatsPage.pageName,
Menu.i("Player") / PlayerPage.pageName >> Hidden,
Menu.i("Chart") / GamePage.pageName >> Hidden,
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/info/nanodesu/lib/Formattings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import net.liftweb.util.Props
* Formatting helpers
*/
object Formattings {
def unicodeEscape(in: String): String = in.map(x => "\\u%04X".format(x.toInt)).foldRight("")((a, b) => a+b)

def formatGameDuration(start: Long, end: Long) = {
val liveGameThreshold = Props.getInt("liveGameThreshold").openOr(15000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import info.nanodesu.model.db.collectors.playerinfo.loader.CountGamesForPlayerLo
import info.nanodesu.model.db.collectors.playerinfo.loader.IsReporterLoader
import net.liftweb.common.Loggable
import java.math.BigInteger
import org.apache.commons.lang.StringEscapeUtils
import info.nanodesu.lib.Formattings
import net.liftweb.util.StringHelpers

case class DailyValue(day: Long, value: Double)

Expand Down Expand Up @@ -50,8 +53,8 @@ class PlayerInfoCollector(db: DSLContext, player: Int, gameId: Option[Int])
}
ValuesPoint(d._1.day, d._1.value.toInt, d._2.value, d._3.value)
}

DailyValues(Map(player.toString -> values), Map(player.toString -> NameValue(currentDisplayName)))
// we need to escape here or are in danger of weird illegal characters on the page :(
DailyValues(Map(player.toString -> values), Map(player.toString -> NameValue(StringEscapeUtils.escapeHtml(currentDisplayName))))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ object StatisticsReportService extends RestHelper with Loggable {
where(games.WINNER_TEAM.isNotNull()).
and(epoch(games.START_TIME).gt(startTime)).
and(epoch(games.START_TIME).lt(endTime)).
groupBy(teams.INGAME_ID, playerGameRels.P, names.DISPLAY_NAME, games.WINNER_TEAM, games.ID, players.UBER_NAME).orderBy(games.ID).fetch()
groupBy(teams.INGAME_ID, playerGameRels.P, names.DISPLAY_NAME, games.WINNER_TEAM, games.ID, players.UBER_NAME).fetch()

val lst = result.asScala.toList
val byGames = lst.groupBy(_.getValue(games.ID))
Expand All @@ -81,7 +81,7 @@ object StatisticsReportService extends RestHelper with Loggable {
Team(t._1, playersInTeam)
}).toList
Game(x._1, teamsWithPlayers, x._2.head.getValue(games.WINNER_TEAM))
}).toList
}).toList.sortBy(_.gameId)
}
}

Expand Down
11 changes: 5 additions & 6 deletions src/main/scala/info/nanodesu/snippet/PlayerInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import info.nanodesu.model.db.collectors.playerinfo.PlayerHistoryEntry
import net.liftweb.json.Extraction
import net.liftweb.json._
import net.liftweb.json.JsonDSL._
import info.nanodesu.lib.Formattings

object PlayerInfo extends DispatchSnippet with Loggable {

Expand All @@ -35,13 +36,11 @@ object PlayerInfo extends DispatchSnippet with Loggable {
val inf = CookieBox withSession { db =>
PlayerInfoCollector(db, selectedPlayer)
}


val txt = s"var chartdata = ${compact(render(Extraction decompose inf.dailyValues))}"

val graphData =
<script type="text/javascript">
{"// <![CDATA["}
var chartdata = {compact(render(Extraction decompose inf.dailyValues))};
{"// ]]>"}
</script>
<script type="text/javascript">{txt}</script>

if (inf.isReporter) {
"#playerName *" #> inf.currentDisplayName &
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/static/outsourced/lib/rickshaw.a.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,7 @@ Rickshaw.Graph.HoverDetail = Rickshaw.Class.create({
},

formatter: function(series, x, y, formattedX, formattedY, d) {
return series.name + ':&nbsp;' + formattedY;
return $('<div/>').text(series.name + ' ' + formattedY).html();
},

update: function(e) {
Expand Down
5 changes: 5 additions & 0 deletions src/main/webapp/updates.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ <h1>Changelog</h1>
<div>Here I will present you with the most recent updates to PA Stats :)</div>
<div>Note that you can find the latest issues on Github: <a href="https://github.com/pamods/PA-Stats-Server/issues?labels=&milestone=&page=1&state=open">LINK</a></div>
<br/>
<h4>v13.2.0</h4>
<ul>
<li>Added link to the -under construction- ladder page</li>
<li>Fixed an internal bug</li>
</ul>
<h4>v13.1.0</h4>
<ul>
<li>Fixed a bug in the mod that caused the ingame-checkboxes to appear next to the controls for Planet smashing</li>
Expand Down

0 comments on commit 41af5b2

Please sign in to comment.