From 7e4df6072255601549659e82553d0a32ee40cdf6 Mon Sep 17 00:00:00 2001 From: Matthew Date: Mon, 4 Oct 2021 15:13:58 -0700 Subject: [PATCH] Always return results with the newest request first. This also resolves an off-by-one error when using slice --- src/fio/fioEngine.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/fio/fioEngine.js b/src/fio/fioEngine.js index aa4cc5dbe..6829edaf3 100644 --- a/src/fio/fioEngine.js +++ b/src/fio/fioEngine.js @@ -312,18 +312,12 @@ export class FioEngine extends CurrencyEngine { getFioRequests: async ( type: string, page: number, - itemsPerPage: number = 50, - newFirst: boolean = false + itemsPerPage: number = 50 ): Promise => { const startIndex = itemsPerPage * (page - 1) - const endIndex = itemsPerPage * page - 1 - if (newFirst) { - return this.otherData.fioRequests[type] - .sort((a, b) => (a.time_stamp < b.time_stamp ? 1 : -1)) - .slice(startIndex, endIndex) - } + const endIndex = itemsPerPage * page return this.otherData.fioRequests[type] - .sort((a, b) => (a.time_stamp < b.time_stamp ? -1 : 1)) + .sort((a, b) => (a.time_stamp < b.time_stamp ? 1 : -1)) .slice(startIndex, endIndex) } }