diff options
Diffstat (limited to 'rankings/filter.go')
| -rw-r--r-- | rankings/filter.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/rankings/filter.go b/rankings/filter.go index 5f54a81..1d7233b 100644 --- a/rankings/filter.go +++ b/rankings/filter.go | |||
| @@ -33,6 +33,7 @@ func filterRankings(spRankings, mpRankings, overallRankings *[]*Player, players | |||
| 33 | }) | 33 | }) |
| 34 | 34 | ||
| 35 | rank := 1 | 35 | rank := 1 |
| 36 | offset := 0 | ||
| 36 | 37 | ||
| 37 | for idx := 0; idx < len(*spRankings); idx++ { | 38 | for idx := 0; idx < len(*spRankings); idx++ { |
| 38 | if idx == 0 { | 39 | if idx == 0 { |
| @@ -40,7 +41,10 @@ func filterRankings(spRankings, mpRankings, overallRankings *[]*Player, players | |||
| 40 | continue | 41 | continue |
| 41 | } | 42 | } |
| 42 | if (*spRankings)[idx-1].SpScoreCount != (*spRankings)[idx].SpScoreCount { | 43 | if (*spRankings)[idx-1].SpScoreCount != (*spRankings)[idx].SpScoreCount { |
| 43 | rank++ | 44 | rank = rank + offset + 1 |
| 45 | offset = 0 | ||
| 46 | } else { | ||
| 47 | offset++ | ||
| 44 | } | 48 | } |
| 45 | (*spRankings)[idx].SpRank = rank | 49 | (*spRankings)[idx].SpRank = rank |
| 46 | } | 50 | } |
| @@ -50,6 +54,7 @@ func filterRankings(spRankings, mpRankings, overallRankings *[]*Player, players | |||
| 50 | }) | 54 | }) |
| 51 | 55 | ||
| 52 | rank = 1 | 56 | rank = 1 |
| 57 | offset = 0 | ||
| 53 | 58 | ||
| 54 | for idx := 0; idx < len(*mpRankings); idx++ { | 59 | for idx := 0; idx < len(*mpRankings); idx++ { |
| 55 | if idx == 0 { | 60 | if idx == 0 { |
| @@ -57,7 +62,10 @@ func filterRankings(spRankings, mpRankings, overallRankings *[]*Player, players | |||
| 57 | continue | 62 | continue |
| 58 | } | 63 | } |
| 59 | if (*mpRankings)[idx-1].MpScoreCount != (*mpRankings)[idx].MpScoreCount { | 64 | if (*mpRankings)[idx-1].MpScoreCount != (*mpRankings)[idx].MpScoreCount { |
| 60 | rank++ | 65 | rank = rank + offset + 1 |
| 66 | offset = 0 | ||
| 67 | } else { | ||
| 68 | offset++ | ||
| 61 | } | 69 | } |
| 62 | (*mpRankings)[idx].MpRank = rank | 70 | (*mpRankings)[idx].MpRank = rank |
| 63 | } | 71 | } |
| @@ -67,6 +75,7 @@ func filterRankings(spRankings, mpRankings, overallRankings *[]*Player, players | |||
| 67 | }) | 75 | }) |
| 68 | 76 | ||
| 69 | rank = 1 | 77 | rank = 1 |
| 78 | offset = 0 | ||
| 70 | 79 | ||
| 71 | for idx := 0; idx < len(*overallRankings); idx++ { | 80 | for idx := 0; idx < len(*overallRankings); idx++ { |
| 72 | if idx == 0 { | 81 | if idx == 0 { |
| @@ -74,7 +83,10 @@ func filterRankings(spRankings, mpRankings, overallRankings *[]*Player, players | |||
| 74 | continue | 83 | continue |
| 75 | } | 84 | } |
| 76 | if (*overallRankings)[idx-1].OverallScoreCount != (*overallRankings)[idx].OverallScoreCount { | 85 | if (*overallRankings)[idx-1].OverallScoreCount != (*overallRankings)[idx].OverallScoreCount { |
| 77 | rank++ | 86 | rank = rank + offset + 1 |
| 87 | offset = 0 | ||
| 88 | } else { | ||
| 89 | offset++ | ||
| 78 | } | 90 | } |
| 79 | (*overallRankings)[idx].OverallRank = rank | 91 | (*overallRankings)[idx].OverallRank = rank |
| 80 | } | 92 | } |