Skip to content

Instantly share code, notes, and snippets.

@mathjazz
Created October 26, 2016 18:05
Show Gist options
  • Save mathjazz/15066167c611720ed89fc945300c94fd to your computer and use it in GitHub Desktop.
Save mathjazz/15066167c611720ed89fc945300c94fd to your computer and use it in GitHub Desktop.
diff --git a/pontoon/base/models.py b/pontoon/base/models.py
index d5c353b..38b8a5e 100644
--- a/pontoon/base/models.py
+++ b/pontoon/base/models.py
@@ -1236,34 +1236,23 @@ class EntityQuerySet(models.QuerySet):
)
)
- def fuzzy(self, locale):
- return self.with_status_counts(locale).filter(
- Q(fuzzy_count=F('expected_count')) & ~Q(approved_count=F('expected_count'))
- )
+ def fuzzy(self):
+ return Q(fuzzy_count=F('expected_count')) & ~Q(approved_count=F('expected_count'))
--- a/pontoon/base/tests/test_models.py
+++ b/pontoon/base/tests/test_models.py
@@ -1158,7 +1158,10 @@ class EntityFilterTests(TestCase):
fuzzy=True
)
- assert_equal({first_entity, third_entity}, set(Entity.objects.fuzzy(self.locale)))
+ assert_equal(
+ {first_entity, third_entity},
+ set(Entity.objects.with_status_counts(self.locale).filter(Entity.objects.fuzzy()))
+ )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment