stats tweaks, added apocalypse
This commit is contained in:
@@ -131,10 +131,37 @@ struct StatsController: RouteCollection {
|
|||||||
|
|
||||||
|
|
||||||
private func shouldCountMatch (match:Match) -> Bool {
|
private func shouldCountMatch (match:Match) -> Bool {
|
||||||
|
|
||||||
let isColdWar = match.codGame == "bocw"
|
let isColdWar = match.codGame == "bocw"
|
||||||
let numberOfPlayers = self.numberOfPlayers(match: match)
|
let numberOfPlayers = self.numberOfPlayers(match: match)
|
||||||
|
|
||||||
return !isColdWar || (isColdWar && (numberOfPlayers == 0 || numberOfPlayers > 4 ))
|
if isColdWar {
|
||||||
|
if numberOfPlayers == 0 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
else if numberOfPlayers > 4 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
if numberOfPlayers > 4 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
else if numberOfPlayers == 4 {
|
||||||
|
return match.date > Date(timeIntervalSince1970: 1612159200)
|
||||||
|
|
||||||
|
} // February 1 2021
|
||||||
|
else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -475,7 +502,7 @@ struct StatsController: RouteCollection {
|
|||||||
var mostRecentStats:Stats?
|
var mostRecentStats:Stats?
|
||||||
var mwSixPlayers:Stats?
|
var mwSixPlayers:Stats?
|
||||||
var mwFivePlayers:Stats?
|
var mwFivePlayers:Stats?
|
||||||
var mwFourPlayers:Stats?
|
var overallFourPlayers:Stats?
|
||||||
|
|
||||||
var mapStats:[Int:Stats]?
|
var mapStats:[Int:Stats]?
|
||||||
var worstMap:Int?
|
var worstMap:Int?
|
||||||
@@ -543,21 +570,21 @@ struct StatsController: RouteCollection {
|
|||||||
|
|
||||||
group.enter()
|
group.enter()
|
||||||
queue.async {
|
queue.async {
|
||||||
mwFourPlayers = self.getStatsByPlayerCount(matches: matches, playerCount: 4)
|
overallFourPlayers = self.getStatsByPlayerCount(matches: matches.filter{$0.date > Date(timeIntervalSince1970: 1612159200)}, playerCount: 4)
|
||||||
group.leave()
|
group.leave()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
group.enter()
|
group.enter()
|
||||||
queue.async {
|
queue.async {
|
||||||
mwFivePlayers = self.getStatsByPlayerCount(matches: matches, playerCount: 5)
|
mwFivePlayers = self.getStatsByPlayerCount(matches: matches.filter{$0.codGame == "mw"}, playerCount: 5)
|
||||||
group.leave()
|
group.leave()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
group.enter()
|
group.enter()
|
||||||
queue.async {
|
queue.async {
|
||||||
mwSixPlayers = self.getStatsByPlayerCount(matches: matches, playerCount: 6)
|
mwSixPlayers = self.getStatsByPlayerCount(matches: matches.filter{$0.codGame == "mw"}, playerCount: 6)
|
||||||
group.leave()
|
group.leave()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -570,7 +597,7 @@ struct StatsController: RouteCollection {
|
|||||||
DashboardItem(title: "MW Overall", content: mwStats!.record, title2: "Ratio", content2: mwStats!.winLossRatio),
|
DashboardItem(title: "MW Overall", content: mwStats!.record, title2: "Ratio", content2: mwStats!.winLossRatio),
|
||||||
DashboardItem(title: "MW 6 Players ", content: mwSixPlayers!.record, title2: "Ratio", content2: mwSixPlayers!.winLossRatio),
|
DashboardItem(title: "MW 6 Players ", content: mwSixPlayers!.record, title2: "Ratio", content2: mwSixPlayers!.winLossRatio),
|
||||||
DashboardItem(title: "MW 5 Players ", content: mwFivePlayers!.record, title2: "Ratio", content2: mwFivePlayers!.winLossRatio),
|
DashboardItem(title: "MW 5 Players ", content: mwFivePlayers!.record, title2: "Ratio", content2: mwFivePlayers!.winLossRatio),
|
||||||
DashboardItem(title: "MW 4 Players ", content: mwFourPlayers!.record, title2: "Ratio", content2: mwFourPlayers!.winLossRatio),
|
DashboardItem(title: "Overall 4 Players ", content: overallFourPlayers!.record, title2: "Ratio", content2: overallFourPlayers!.winLossRatio),
|
||||||
DashboardItem(title: "Overall", content: overallStats!.record, title2: "Ratio", content2: overallStats!.winLossRatio),
|
DashboardItem(title: "Overall", content: overallStats!.record, title2: "Ratio", content2: overallStats!.winLossRatio),
|
||||||
DashboardItem(title: "2021 Overall", content: statsFor2021.record, title2: "Ratio", content2: statsFor2021.winLossRatio),
|
DashboardItem(title: "2021 Overall", content: statsFor2021.record, title2: "Ratio", content2: statsFor2021.winLossRatio),
|
||||||
DashboardItem(title: "2020 Overall", content: statsFor2020.record, title2: "Ratio", content2: statsFor2020.winLossRatio),
|
DashboardItem(title: "2020 Overall", content: statsFor2020.record, title2: "Ratio", content2: statsFor2020.winLossRatio),
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ class MapData {
|
|||||||
30: Map(id: 30, name: "Raid", imageName: "bocw_raid"),
|
30: Map(id: 30, name: "Raid", imageName: "bocw_raid"),
|
||||||
32: Map(id: 32, name: "Piccadilly", imageName: "mw_piccadilly"),
|
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")
|
34: Map(id: 34, name: "Express", imageName: "bocw_express"),
|
||||||
|
35: Map(id: 35, name: "Apocalypse", imageName: "bocw_apocalypse")
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user