added express

This commit is contained in:
Michael Simard
2021-02-04 14:03:28 -06:00
parent 69829a9f01
commit 74b034e104
2 changed files with 6 additions and 15 deletions

View File

@@ -511,7 +511,6 @@ struct StatsController: RouteCollection {
//print ("cw done \(Date().timeIntervalSince(startTime))")
group.leave()
}
group.enter()
@@ -556,7 +555,6 @@ struct StatsController: RouteCollection {
}
group.enter()
queue.async {
mwSixPlayers = self.getStatsByPlayerCount(matches: matches, playerCount: 6)
@@ -612,27 +610,18 @@ struct StatsController: RouteCollection {
}
let ratio = wins / loss
return records
}
}
func mapsSortedByBest (records :[ Int:Stats] ) -> [ Int ]
{
func mapsSortedByBest (records :[ Int:Stats] ) -> [ Int ] {
return records.keys.sorted { (map1, map2) -> Bool in
return records[map1]?.getRatioDouble() ?? 0.0 < records[map2]?.getRatioDouble() ?? 0.0
}.reversed()
}
func getStatsByPlayerCount(matches:[Match], playerCount:Int) -> Stats {
return getStats(matches: matches.filter{$0.playerList.count == playerCount})
}
func getBestMap (records :[ Int:Stats] ) -> Int {

View File

@@ -44,12 +44,14 @@ class MapData {
29: Map(id: 29, name: "Nuketown Holiday", imageName: "bocw_nuketown_holiday"),
30: Map(id: 30, name: "Raid", imageName: "bocw_raid"),
32: Map(id: 32, name: "Piccadilly", imageName: "mw_piccadilly"),
33: Map(id: 33, name: "Grazna Raid", imageName: "mw_grazna")
33: Map(id: 33, name: "Grazna Raid", imageName: "mw_grazna"),
34: Map(id: 34, name: "Express", imageName: "bocw_express")
]
static let bocwMaps = {
return [1,3,8,7,4,2,29,31,5,6,30,0].compactMap {
return [1,3,8,7,4,2,29,31,5,6,30,0,34].compactMap {
return allMaps[$0];
}
.sorted { (m1, m2) -> Bool in