diff --git a/Sources/App/Controllers/StatsController.swift b/Sources/App/Controllers/StatsController.swift index bf84808..137ffec 100644 --- a/Sources/App/Controllers/StatsController.swift +++ b/Sources/App/Controllers/StatsController.swift @@ -168,6 +168,13 @@ struct StatsController: RouteCollection { sortOrder = -79 backgroundColor = colors.first(where: {$0.gameId == "bocw"})?.tileColour ?? backgroundColor } + else if statisticItem.codTrackerId == "vg_competitive"{ + title2 = "Ratio" + content1 = "\(statisticItem.wins)-\(statisticItem.losses)" + content2 = Utils.getRatio(wins: statisticItem.wins, losses: statisticItem.losses) + sortOrder = -81 + backgroundColor = colors.first(where: {$0.gameId == "vg"})?.tileColour ?? backgroundColor + } else { @@ -691,7 +698,8 @@ struct StatsController: RouteCollection { var mwFivePlayers:Stats? var overallFourPlayers:Stats? var blackOpsColdWarNuketownHalloween:Stats? - + var vgCompetitive:StatsWithMostRecentDailyRecord? + // var mapStats:[Int:Stats]? @@ -752,6 +760,17 @@ struct StatsController: RouteCollection { } + group.enter() + queue.async { + + vgCompetitive = self.getStatsWithMostRecentDailyRecord(sortedMatches: matches.filter({ (match) -> Bool in + return match.codGame == "vg" && self.shouldCountMatch(match: match ) + })) + + + group.leave() + } + group.wait() return [ @@ -769,6 +788,8 @@ struct StatsController: RouteCollection { "casual_overall":Stats(totalWins: casualOverall.totalWins, totalLosses: casualOverall.totalLosses), "bocw_casual":Stats(totalWins: bocwCasual.totalWins, totalLosses: bocwCasual.totalLosses), "vg_casual":Stats(totalWins: vgCasual.totalWins, totalLosses: vgCasual.totalLosses), + "vg_competitive":Stats(totalWins: vgCompetitive!.totalWins, totalLosses: vgCompetitive!.totalLosses), + ] }