From f6bd455a2e3f470d250c8e307961bcfaf6e5a258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 28 Feb 2012 10:17:57 +0100 Subject: [PATCH] Update stats when storing units --- trans/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/trans/models.py b/trans/models.py index 90512ef28..d9c9b6dc7 100644 --- a/trans/models.py +++ b/trans/models.py @@ -198,7 +198,12 @@ class Translation(models.Model): # Delete not used units Unit.objects.filter(translation = self, id__in = oldunits).delete() - # Update revision + # Update revision and stats + total = self.unit_set.count() + fuzzy = self.unit_set.filter(fuzzy = True).count() + translated = self.unit_set.filter(translated = True).count() + self.fuzzy = fuzzy * 1.0 / total + self.translated = translated * 1.0 / total self.revision = blob.hexsha self.save()