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

24849 change request search back to search functionality #1630

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/namex/VERSION.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.2.15'
__version__ = '1.2.16'
7 changes: 4 additions & 3 deletions api/namex/resources/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,13 @@ def get():
example: query=NR3742302 or query=abcd
"""
data = []
nr_num = request.args.get('query', '').strip().upper()
nr_num = '%' + request.args.get('query', '').strip().upper() + '%'
rows = request.args.get('rows', 10, type=int)

try:
# Find the NR only if it is not cancelled & not expired or if it has expired within a 60 day grace period.
query = RequestDAO.query.filter(
RequestDAO.nrNum == nr_num,
RequestDAO.nrNum.like(nr_num),
RequestDAO.stateCd != State.CANCELLED,
or_(
RequestDAO.stateCd != State.EXPIRED,
Expand All @@ -404,7 +405,7 @@ def get():
lazyload('*'),
eagerload(RequestDAO.names).load_only(Name.name),
load_only(RequestDAO.id, RequestDAO.nrNum)
)
).limit(rows)
result = query.all()
data = [{
'nrNum': nr.nrNum,
Expand Down
Loading