Commit 89909dbe authored by Michal Čihař's avatar Michal Čihař

Count words when working with translation

parent 4af393a2
......@@ -593,6 +593,15 @@ class Translation(models.Model, URLMixin):
'''
Updates translation statistics.
'''
self.total_words = self.unit_set.aggegate(
Sum('num_words')
)['num_words']
self.translated_words = self.unit_set.filter(
translated=True
).aggegate(
Sum('num_words')
)['num_words']
self.total = self.unit_set.count()
self.fuzzy = self.unit_set.filter(
fuzzy=True
......@@ -600,12 +609,14 @@ class Translation(models.Model, URLMixin):
self.translated = self.unit_set.filter(
translated=True
).count()
self.failing_checks = self.unit_set.filter(
has_failing_check=True
).count()
self.have_suggestion = self.unit_set.filter(
has_suggestion=True
).count()
self.save()
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