add punch count and inflicted damage

This commit is contained in:
Thomas Rudin 2018-09-25 15:49:27 +02:00
parent f4b544aeaa
commit a33e91df4c
2 changed files with 9 additions and 1 deletions

View File

@ -167,6 +167,8 @@
m("td", numberWithCommas(player.attributes.crafted)),
m("td", numberWithCommas(player.attributes.placed_nodes)),
m("td", player.attributes.died),
m("td", numberWithCommas(player.attributes.punch_count)),
m("td", numberWithCommas(player.attributes.inflicted_damage)),
m("td", player.attributes.played_time ? moment.duration(+player.attributes.played_time, "seconds").humanize() : ""),
m("td", joined),
m("td", [last_login, " ", (is_inactive?inactive:null)]),
@ -192,6 +194,8 @@
m("th", ["Craft-count", makeSortButton("crafted")]),
m("th", ["Build-count", makeSortButton("placed_nodes")]),
m("th", ["Death-count", makeSortButton("died")]),
m("th", ["Punch-count", makeSortButton("punch_count")]),
m("th", ["Inflicted damage", makeSortButton("inflicted_damage")]),
m("th", ["Play-time", makeSortButton("played_time")]),
m("th", ["Joined", makeSortButton("joined")]),
m("th", ["Last login", makeSortButton("online")]),

View File

@ -27,6 +27,10 @@ app.get('/api/highscore', function (req, res) {
attrJoinColumn = req.query.sort;
} else if (req.query.sort == "died"){
attrJoinColumn = req.query.sort;
} else if (req.query.sort == "punch_count"){
attrJoinColumn = req.query.sort;
} else if (req.query.sort == "inflicted_damage"){
attrJoinColumn = req.query.sort;
} else if (req.query.sort == "played_time"){
attrJoinColumn = req.query.sort;
} else if (req.query.sort == "online"){
@ -57,7 +61,7 @@ app.get('/api/highscore', function (req, res) {
var promises = result.rows.map(row => {
var subquery = "select attr, value from player_metadata where player = $1";
subquery += " and attr in('crafted', 'placed_nodes', 'died', 'digged_nodes', 'xp', 'played_time', 'homedecor:player_skin')";
subquery += " and attr in('crafted', 'placed_nodes', 'died', 'digged_nodes', 'xp', 'played_time', 'punch_count', 'inflicted_damage', 'homedecor:player_skin')";
return pool.query(subquery, [row.name])