Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Task]: Modify agency filter to do exact matches rather than the strbegins approach we have #1494

Closed
1 task
chouinar opened this issue Mar 18, 2024 · 0 comments · Fixed by #1530
Closed
1 task
Assignees
Labels
project: grants.gov Grants.gov Modernization tickets

Comments

@chouinar
Copy link
Collaborator

chouinar commented Mar 18, 2024

Summary

After chatting with the front-end folks, they plan to send us every agency nested inside of an agency, so we don't need to keep the confusing agency prefix approach we have.

We can change the query from:

            stmt = stmt.where(
                or_(*[Opportunity.agency.istartswith(agency) for agency in one_of_agencies])
            )

to

            stmt = stmt.where(
                Opportunity.agency.in_(one_of_agencies)
            )

and fix tests accordingly

Acceptance criteria

  • Logic adjusted as described above
@chouinar chouinar added the project: grants.gov Grants.gov Modernization tickets label Mar 18, 2024
@chouinar chouinar added this to the Search API - API development milestone Mar 18, 2024
@chouinar chouinar self-assigned this Mar 22, 2024
chouinar added a commit that referenced this issue Mar 27, 2024
## Summary
Fixes #1494

### Time to review: __2 mins__

## Changes proposed
Adjust the logic for filtering by agency to be an exact match instead of
the prior "starts with" logic.

## Context for reviewers
This adjustments comes out of a recent discussion with our front-end
folks. Turns out they intend to pass us every agency for sub-agencies
(eg. `HHS-123`, `HHS-456`, etc). I had implemented sub-agency logic
assuming we'd want prefixes, which is clunky. This makes the logic more
intuitive by just being a simple match.

Note that previously the agencies were also case-insensitive which is no
longer here, but that also isn't really necessary.

## Additional information
Updated a few tests that assumed prior logic - nothing too significant
here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project: grants.gov Grants.gov Modernization tickets
Projects
Development

Successfully merging a pull request may close this issue.

1 participant