From 3d0a14ba4a5d89eb9af538eaf276836baeff05d5 Mon Sep 17 00:00:00 2001 From: Michael Simard Date: Wed, 16 Dec 2020 11:36:54 -0600 Subject: [PATCH] fixed history --- Sources/App/Controllers/StatsController.swift | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Sources/App/Controllers/StatsController.swift b/Sources/App/Controllers/StatsController.swift index 6aae798..3397583 100644 --- a/Sources/App/Controllers/StatsController.swift +++ b/Sources/App/Controllers/StatsController.swift @@ -26,9 +26,6 @@ struct StatsController: RouteCollection { statsRoute.get("history","page",":page", use: history) statsRoute.get("history", use: history) - - - } @@ -38,14 +35,12 @@ struct StatsController: RouteCollection { return Match.query(on: req.db).count().flatMap { (totalMatches) -> EventLoopFuture in - let startRecord = min (page * 20 + 20, totalMatches) + let startRecord = min (page * 20, totalMatches) let lastRecord = min (startRecord + 20, totalMatches) return Match.query(on: req.db).sort(\.$date, .descending).range(startRecord.. (MatchHistory) in - return MatchHistory(total:totalMatches, matches: matches, hasMorePages: lastRecord < totalMatches) - } }