Skip to content

Commit

Permalink
[cleanup] refactor OpenLib sort into getOpenLibResult
Browse files Browse the repository at this point in the history
  • Loading branch information
mikiher committed Sep 30, 2023
1 parent f092972 commit 1d3ad38
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions server/finders/BookFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ class BookFinder {
if (!booksFiltered.length && books.length) {
if (this.verbose) Logger.debug(`Search has ${books.length} matches, but no close title matches`)
}
booksFiltered.sort((a, b) => {
return a.totalDistance - b.totalDistance
})

return booksFiltered
}

Expand Down Expand Up @@ -282,12 +286,6 @@ class BookFinder {
}
}

if (provider === 'openlibrary') {
books.sort((a, b) => {
return a.totalDistance - b.totalDistance
})
}

return books
}

Expand Down

0 comments on commit 1d3ad38

Please sign in to comment.