Skip to content

Commit

Permalink
Merge pull request #406 from GateNLP/case-insensitive-project-search
Browse files Browse the repository at this point in the history
Case insensitive project search
  • Loading branch information
ianroberts authored Mar 13, 2024
2 parents 6993266 + ce57783 commit b67e615
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ def get_projects(request, current_page=1, page_size=None, filters=None):
# Perform filtering
if isinstance(filters, str):
# Search project title if is filter is a string only
projects_query = Project.objects.filter(name__contains=filters.strip())
projects_query = Project.objects.filter(name__icontains=filters.strip())
total_count = projects_query.count()
else:
projects_query = Project.objects.all()
Expand Down
4 changes: 4 additions & 0 deletions backend/tests/test_rpc_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,10 @@ def test_get_projects(self):
self.assertEqual(len(result["items"]), 1)
self.assertEqual(result["total_count"], 1)

# Ensure filtering is case-insensitive
result = get_projects(self.get_loggedin_request(), 1, page_size, "pROJECT 1")
self.assertEqual(len(result["items"]), 1)
self.assertEqual(result["total_count"], 1)



Expand Down

0 comments on commit b67e615

Please sign in to comment.