Factor out stats updating
This commit is contained in:
parent
0ab1aabd03
commit
87d198909d
@ -226,12 +226,17 @@ class Translation(models.Model):
|
||||
Unit.objects.filter(translation = self, id__in = oldunits).delete()
|
||||
|
||||
# Update revision and stats
|
||||
self.update_stats(False)
|
||||
self.revision = blob.hexsha
|
||||
self.save()
|
||||
|
||||
def update_stats(self, dosave = True):
|
||||
total = self.unit_set.count()
|
||||
fuzzy = self.unit_set.filter(fuzzy = True).count()
|
||||
translated = self.unit_set.filter(translated = True).count()
|
||||
self.fuzzy = round(fuzzy * 100.0 / total, 1)
|
||||
self.translated = round(translated * 100.0 / total, 1)
|
||||
self.revision = blob.hexsha
|
||||
if dosave:
|
||||
self.save()
|
||||
|
||||
def git_commit(self, author):
|
||||
|
Loading…
Reference in New Issue
Block a user