Skip to content

Commit

Permalink
Merge pull request #329 from EdgeApp/matthew/fioRequestsSort
Browse files Browse the repository at this point in the history
Always return results with the newest request first.
  • Loading branch information
peachbits authored Oct 4, 2021
2 parents 187506e + 7e4df60 commit 2500fe2
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/fio/fioEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<FioRequest[]> => {
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)
}
}
Expand Down

0 comments on commit 2500fe2

Please sign in to comment.