Skip to content

Commit

Permalink
- change geoarea title filter from icontains to iexact
Browse files Browse the repository at this point in the history
  • Loading branch information
sudan45 committed Apr 17, 2024
1 parent 3a1cbc7 commit 149b2b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/geo/filter_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def filter_titles(self, queryset, _, values):
reduce(
lambda acc, item: acc | item,
[
models.Q(title__icontains=value)
models.Q(title__iexact=value)
for value in _values
]
)
Expand Down
7 changes: 6 additions & 1 deletion apps/project/tests/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,16 @@ def _query_check(variables={}, **kwargs):
self.assertEqual(len(content), 1, content)
self.assertEqual(content, [geo1_data], content)

filters = {'titles': ['kathm', 'lalit'], 'ordering': self.genum(GeoAreaOrderingEnum.ASC_ID)}
filters = {'titles': ['Kathmandu', 'lalitpur'], 'ordering': self.genum(GeoAreaOrderingEnum.ASC_ID)}
content = _query_check(variables=filters)['data']['project']['geoAreas']['results']
self.assertEqual(len(content), 2, content)
self.assertEqual(content, [geo1_data, geo2_data], content)

filters = {'titles': ['Kath', 'lal'], 'ordering': self.genum(GeoAreaOrderingEnum.ASC_ID)}
content = _query_check(variables=filters)['data']['project']['geoAreas']['results']
self.assertEqual(len(content), 0, content)
self.assertEqual(content, [], content)

def test_project_stat_recent(self):
query = '''
query MyQuery {
Expand Down

0 comments on commit 149b2b8

Please sign in to comment.