Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
fixup! Add ContributorManager with filter_by_name method
Browse files Browse the repository at this point in the history
  • Loading branch information
jwalgran committed Jan 27, 2022
1 parent ca9af42 commit 945925c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/django/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def filter_by_name(self, name):
False is less than True so we order_by boolean fields in descending
order
"""
threhold = ContributorManager.TRIGRAM_SIMILARY_THRESHOLD
threshold = ContributorManager.TRIGRAM_SIMILARY_THRESHOLD
matches = self \
.annotate(active_source_count=models.Count(
Q(source__is_active=True))) \
Expand All @@ -108,7 +108,7 @@ def filter_by_name(self, name):
Q(active_source_count__gt=0),
models.BooleanField())) \
.annotate(similarity=TrigramSimilarity('name', name)) \
.filter(similarity__gte=threhold) \
.filter(similarity__gte=threshold) \
.order_by('-similarity', '-is_verified', '-has_active_sources')
return matches

Expand Down

0 comments on commit 945925c

Please sign in to comment.