Commit 880b9644 authored by Michal Čihař's avatar Michal Čihař

Count fuzzy/failing checks words as well

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 8011d9fa
...@@ -129,6 +129,8 @@ class Translation(models.Model, URLMixin, PercentMixin): ...@@ -129,6 +129,8 @@ class Translation(models.Model, URLMixin, PercentMixin):
fuzzy = models.IntegerField(default=0, db_index=True) fuzzy = models.IntegerField(default=0, db_index=True)
total = models.IntegerField(default=0, db_index=True) total = models.IntegerField(default=0, db_index=True)
translated_words = models.IntegerField(default=0) translated_words = models.IntegerField(default=0)
fuzzy_words = models.IntegerField(default=0)
failing_checks_words = models.IntegerField(default=0)
total_words = models.IntegerField(default=0) total_words = models.IntegerField(default=0)
failing_checks = models.IntegerField(default=0, db_index=True) failing_checks = models.IntegerField(default=0, db_index=True)
have_suggestion = models.IntegerField(default=0, db_index=True) have_suggestion = models.IntegerField(default=0, db_index=True)
...@@ -689,6 +691,26 @@ class Translation(models.Model, URLMixin, PercentMixin): ...@@ -689,6 +691,26 @@ class Translation(models.Model, URLMixin, PercentMixin):
if self.translated_words is None: if self.translated_words is None:
self.translated_words = 0 self.translated_words = 0
# Count fuzzy words
self.fuzzy_words = self.unit_set.filter(
fuzzy=True
).aggregate(
Sum('num_words')
)['num_words__sum']
# Nothing matches filter
if self.fuzzy_words is None:
self.fuzzy_words = 0
# Count words with failing checks
self.failing_checks_words = self.unit_set.filter(
has_failing_check=True
).aggregate(
Sum('num_words')
)['num_words__sum']
# Nothing matches filter
if self.failing_checks_words is None:
self.failing_checks_words = 0
# Store hash will save object # Store hash will save object
self.store_hash() self.store_hash()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment