fixed issue with cumulative stats
This commit is contained in:
@@ -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
|
return getStatsForDay(year: first.year, month: first.month, day:first.day, req: req).flatMap { [remaining, allDailyStats] (stats) -> EventLoopFuture<[DailyStats]> in
|
||||||
var allDailyStats = allDailyStats
|
var allDailyStats = allDailyStats
|
||||||
|
|
||||||
let totalWins = allDailyStats.reduce(0) { (total, dailyStats) -> Double in
|
let totalWins = allDailyStats.reduce(Double(stats.totalWins)) { (total, dailyStats) -> Double in
|
||||||
return total + Double(dailyStats.stats.totalWins)
|
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)
|
return total + Double(dailyStats.stats.totalLosses)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user