Skip to content

Commit

Permalink
refactor: some limit adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Jan 17, 2024
1 parent d062e52 commit 15a080c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions server/src/models/Pokemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ class Pokemon extends Model {
longitude: bbox.maxLon,
},
maxDistance,
limit: searchResultsLimit * 4,
limit: searchResultsLimit,
searchIds: pokemonIds.map((id) => +id),
global: {},
filters: {},
Expand All @@ -649,9 +649,7 @@ class Pokemon extends Model {
)
return results
.filter(
(item, i) =>
i < searchResultsLimit &&
(!mem || filterRTree(item, perms.areaRestrictions, onlyAreas)),
(item) => !mem || filterRTree(item, perms.areaRestrictions, onlyAreas),
)
.map((poke) => ({
...poke,
Expand Down
4 changes: 2 additions & 2 deletions server/src/services/DbCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,8 @@ module.exports = class DbCheck {
break
}
distance += softLimit
if (deDuped.length === 0) {
distance = Math.min(distance + softLimit, hardLimit)
if (deDuped.length === 0 && distance < hardLimit) {
distance += softLimit
}
}
if (count > 1) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/dialogs/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export default function Search() {
<Box width={{ xs: 'inherit', sm: 500 }}>
<Header titles="search" action={handleClose} />
<Autocomplete
freeSolo={search?.length ? false : true}
freeSolo
inputValue={search}
onInputChange={handleChange}
options={options.map((option, i) => ({ ...option, i }))}
Expand Down

0 comments on commit 15a080c

Please sign in to comment.