From c7cb5fc54a125fff500072f45f0f8348748a0d72 Mon Sep 17 00:00:00 2001 From: Michael Simard Date: Wed, 9 Dec 2020 16:14:07 -0600 Subject: [PATCH] bug fixes --- Sources/App/Controllers/StatsController.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 + }))