我在数组中有这个结构:
[
{
"playerName": "Stack",
"leaguePoints": 100,
"wins": 280,
"miniSeries": {
"progress": "WNN",
"losses": 0,
"wins": 1
}
},
{
"playerName": "Overflow",
"leaguePoints": 90,
"wins": 280
}
{
"playerName": "StackOverflow",
"leaguePoints": 0,
"wins": 100
}
]
我需要像这样对数组元素进行排序:
如果leaguePoints = 100,则按(miniSeries.wins+miniSeries.losses(玩的游戏更多,排名更高))或 miniSeries.progress 中剩余的 N(中立)数量(更少 Ns,排名更高)排序
如果leaguePoints < 100 然后按leaguePoints 排序
如果 LeaguePoints = 0 则按胜利排序
我一直在使用Ege Özcan 的多参数排序,它确实按联赛积分和胜利排序,但我无法让它与 miniSeries 一起使用。
它应该如何最终看起来像:
Name leaguePoints Wins MiniSeries
Stack 100 10 LWN
Stack 100 25 WNN
Stack 100 5 NNN
Stack 99 50 ---
Stack 70 250 ---
Stack 0 300 ---
Stack 0 200 ---
Stack 0 100 ---