Skip to content

Commit

Permalink
Merge pull request #144 from openstates/insentitive-committee-name-ma…
Browse files Browse the repository at this point in the history
…tching

Case Insentitive committee name matching
  • Loading branch information
alexobaseki authored Sep 30, 2024
2 parents ececf68 + c1aad82 commit d022813
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion openstates/importers/organizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ def limit_spec(self, spec: _JsonDict) -> _JsonDict:

name = spec.pop("name", None)
if name:
# __icontains doesn't work for JSONField ArrayField
# so other_name_lowercase_on follows "title" naming pattern
other_name_lowercase_on = name.title().replace(" On ", " on ")
return Q(**spec) & (
Q(name=name) | Q(other_names__contains=[{"name": name}])
Q(name__iexact=name)
| Q(other_names__contains=[{"name": other_name_lowercase_on}])
)
return spec

0 comments on commit d022813

Please sign in to comment.