recalc new stats

This commit is contained in:
Michael Simard
2022-11-26 16:24:08 -06:00
parent 4630a20755
commit 79f029b769

View File

@@ -685,6 +685,8 @@ struct StatsController: RouteCollection {
let casualOverall = getCasualStats(db: db) let casualOverall = getCasualStats(db: db)
let bocwCasual = getCasualStatsForGame(db: db, gameId: "bocw") let bocwCasual = getCasualStatsForGame(db: db, gameId: "bocw")
let mw2Casual = getCasualStatsForGame(db: db, gameId: "mw2")
let vgCasual = getCasualStatsForGame(db: db, gameId: "vg", afterDate: Date(timeIntervalSince1970: 1635823473)) //nov 21 to exlude beta time in sept let vgCasual = getCasualStatsForGame(db: db, gameId: "vg", afterDate: Date(timeIntervalSince1970: 1635823473)) //nov 21 to exlude beta time in sept
@@ -709,6 +711,7 @@ struct StatsController: RouteCollection {
var overallFourPlayers:Stats? var overallFourPlayers:Stats?
var blackOpsColdWarNuketownHalloween:Stats? var blackOpsColdWarNuketownHalloween:Stats?
var vgCompetitive:StatsWithMostRecentDailyRecord? var vgCompetitive:StatsWithMostRecentDailyRecord?
var mw2Cometitive:StatsWithMostRecentDailyRecord?
@@ -781,6 +784,17 @@ struct StatsController: RouteCollection {
group.leave() group.leave()
} }
group.enter()
queue.async {
vgCompetitive = self.getStatsWithMostRecentDailyRecord(sortedMatches: matches.filter({ (match) -> Bool in
return match.codGame == "mw2" && self.shouldCountMatch(match: match )
}))
group.leave()
}
group.wait() group.wait()
return [ return [
@@ -799,6 +813,8 @@ struct StatsController: RouteCollection {
"bocw_casual":Stats(totalWins: bocwCasual.totalWins, totalLosses: bocwCasual.totalLosses), "bocw_casual":Stats(totalWins: bocwCasual.totalWins, totalLosses: bocwCasual.totalLosses),
"vg_casual":Stats(totalWins: vgCasual.totalWins, totalLosses: vgCasual.totalLosses), "vg_casual":Stats(totalWins: vgCasual.totalWins, totalLosses: vgCasual.totalLosses),
"vg_competitive":Stats(totalWins: vgCompetitive!.totalWins, totalLosses: vgCompetitive!.totalLosses), "vg_competitive":Stats(totalWins: vgCompetitive!.totalWins, totalLosses: vgCompetitive!.totalLosses),
"mw2_casual":Stats(totalWins: mw2Casual.totalWins, totalLosses: mw2Casual.totalLosses),
"mw2_competitive":Stats(totalWins: mw2Cometitive!.totalWins, totalLosses: mw2Cometitive!.totalLosses),
] ]
} }