diff --git a/Sources/App/Controllers/StatsController.swift b/Sources/App/Controllers/StatsController.swift index f2eebf4..b84bd4f 100644 --- a/Sources/App/Controllers/StatsController.swift +++ b/Sources/App/Controllers/StatsController.swift @@ -262,11 +262,10 @@ struct StatsController: RouteCollection { return getStatsForDay(year: first.year, month: first.month, day:first.day, req: req).flatMap { [remaining, allDailyStats] (stats) -> EventLoopFuture<[DailyStats]> in var allDailyStats = allDailyStats - let totalWins = allDailyStats.reduce(0) { (total, dailyStats) -> Double in - return total + Double(dailyStats.stats.totalWins) - } + let totalWins = allDailyStats.reduce(Double(stats.totalWins)) { (total, dailyStats) -> Double in + return total + Double(dailyStats.stats.totalWins) } - let totalLosses = allDailyStats.reduce(0) { (total, dailyStats) -> Double in + let totalLosses = allDailyStats.reduce(Double(stats.totalLosses)) { (total, dailyStats) -> Double in return total + Double(dailyStats.stats.totalLosses) }