diff --git a/Sources/App/Controllers/StatsController.swift b/Sources/App/Controllers/StatsController.swift index fec91f7..f889eea 100644 --- a/Sources/App/Controllers/StatsController.swift +++ b/Sources/App/Controllers/StatsController.swift @@ -77,9 +77,14 @@ struct StatsController: RouteCollection { func mostRecentDailyStats (matches:[Match]) -> Stats{ let daysPlayed = getDaysPlayed(matches: matches) - + let lastDayPlayed = daysPlayed.last + return getStats(matches: matches.filter({ (match) -> Bool in - return match.date.day == daysPlayed.first?.day && match.date.month == daysPlayed.first?.month && match.date.year == daysPlayed.first?.year && match.date.day == daysPlayed.first?.day + return + match.date.day == lastDayPlayed?.day && + match.date.month == lastDayPlayed?.month && + match.date.year == lastDayPlayed?.year + }))