Skip to content

Add minimum_rank to name autocomplete - #336

Merged
vangberg merged 2 commits into
mainfrom
rank-aware-name-autocomplete
Sep 8, 2026
Merged

Add minimum_rank to name autocomplete#336
vangberg merged 2 commits into
mainfrom
rank-aware-name-autocomplete

Conversation

@vangberg

@vangberg vangberg commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Wait for #332 to be merged first, then rebase this against main.

For #173 it would be nice to be able to specify a minimum rank for the name autocomplete, so we don't show names that are not valid, e.g. families if the name with incertae sedis placement is a species.

In addition, I added formatting which shows the rank of the name.

CleanShot-2026-09-03-09-22-32

I also added a dev-only /dev/autocomplete endpoint which shows the different autocomplete variations. We can remove that if you want.

@vangberg vangberg self-assigned this Sep 3, 2026
@vangberg
vangberg force-pushed the rank-aware-name-autocomplete branch from 9e7d984 to 894a1bb Compare September 3, 2026 11:57
@vangberg
vangberg marked this pull request as draft September 3, 2026 11:59
@vangberg
vangberg changed the base branch from main to direct-batch-placements September 3, 2026 12:00
@vangberg
vangberg force-pushed the direct-batch-placements branch from 2304b7b to f967e96 Compare September 3, 2026 12:12
@vangberg
vangberg force-pushed the rank-aware-name-autocomplete branch from 894a1bb to 0bfb581 Compare September 3, 2026 12:12
@vangberg
vangberg force-pushed the direct-batch-placements branch from f967e96 to 7281549 Compare September 3, 2026 12:28
@vangberg
vangberg force-pushed the rank-aware-name-autocomplete branch from 0bfb581 to 074cca4 Compare September 3, 2026 12:30
@vangberg
vangberg force-pushed the direct-batch-placements branch from 7281549 to 145ea82 Compare September 3, 2026 12:39
@vangberg
vangberg marked this pull request as ready for review September 3, 2026 12:41
@vangberg
vangberg force-pushed the rank-aware-name-autocomplete branch from 074cca4 to 59a7072 Compare September 3, 2026 12:43
@vangberg

vangberg commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@lmrodriguezr This is ready for review as well. Beware that it needs to be rebased against main after merging #332.

Comment thread app/controllers/names_controller.rb Outdated
.limit(20)
@names = @names.where(rank: rank) if rank
if minimum_rank && (rank_index = Name.ranks.index(minimum_rank))
@names = @names.where(rank: Name.ranks.take(rank_index + 1))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe extract to a helper method?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this looks helpful for other parts of the code :)

Base automatically changed from direct-batch-placements to main September 4, 2026 08:48

@lmrodriguezr lmrodriguezr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this! It may not need rebasing but I'll leave the merge for you

@vangberg
vangberg merged commit 227065c into main Sep 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants