Commit c3b4aeb4 authored by mercury233's avatar mercury233

update scores rank sort

parent 506deafa
...@@ -432,8 +432,10 @@ ROOM_player_get_score = (player)-> ...@@ -432,8 +432,10 @@ ROOM_player_get_score = (player)->
if settings.modules.random_duel.post_match_scores if settings.modules.random_duel.post_match_scores
setInterval(()-> setInterval(()->
_scores = _.pairs ROOM_players_scores scores_pair = _.pairs ROOM_players_scores
scores = _.first(_.sortBy(_scores, (score)-> return score[1].win).reverse(), 10) scores_by_lose = _.sortBy(scores_pair, (score)-> return score[1].lose).reverse() # 败场由高到低
scores_by_win = _.sortBy(scores_by_lose, (score)-> return score[1].win).reverse() # 然后胜场由低到高,再逆转,就是先排胜场再排败场
scores = _.first(scores_by_win, 10)
#log.info scores #log.info scores
request.post { url : settings.modules.random_duel.post_match_scores , form : { request.post { url : settings.modules.random_duel.post_match_scores , form : {
accesskey: settings.modules.random_duel.post_match_accesskey, accesskey: settings.modules.random_duel.post_match_accesskey,
......
...@@ -530,11 +530,15 @@ ...@@ -530,11 +530,15 @@
if (settings.modules.random_duel.post_match_scores) { if (settings.modules.random_duel.post_match_scores) {
setInterval(function() { setInterval(function() {
var _scores, scores; var scores, scores_by_lose, scores_by_win, scores_pair;
_scores = _.pairs(ROOM_players_scores); scores_pair = _.pairs(ROOM_players_scores);
scores = _.first(_.sortBy(_scores, function(score) { scores_by_lose = _.sortBy(scores_pair, function(score) {
return score[1].lose;
}).reverse();
scores_by_win = _.sortBy(scores_by_lose, function(score) {
return score[1].win; return score[1].win;
}).reverse(), 10); }).reverse();
scores = _.first(scores_by_win, 10);
request.post({ request.post({
url: settings.modules.random_duel.post_match_scores, url: settings.modules.random_duel.post_match_scores,
form: { form: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment