Within an array, I am working with the following structure:
[
{
"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
}
]
To sort the array elements properly, follow these guidelines:
If leaguePoints = 100, sort by (miniSeries.wins + miniSeries.losses) or number of Ns left in miniSeries.progress
If leaguePoints is less than 100, sort by leaguePoints
If leaguePoints equals 0, sort by wins
I've tried using Ege Özcan's multiple parameters sort, which works for leaguePoints and wins, but not for miniSeries.
The desired outcome should resemble this:
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 ---