[damned-lies] Added PoFile.{tr, fu, un}_word_percentage methods cloning PoFile.{tr, fu, un}_percentage ones



commit fb3ee2d03a0fbd28c7a9c6e4c37e52da03d99762
Author: Gil Forcada <gforcada gnome org>
Date:   Sat Oct 15 21:46:34 2011 +0200

    Added PoFile.{tr,fu,un}_word_percentage methods cloning PoFile.{tr,fu,un}_percentage ones

 stats/models.py |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index f67e4e2..611d394 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -1241,6 +1241,13 @@ class PoFile(models.Model):
         else:
             return int(100*self.translated/pot_size)
 
+    def tr_word_percentage(self):
+        pot_size = self.pot_size(words=True)
+        if pot_size == 0:
+            return 0
+        else:
+            return int(100*self.translated_words/pot_size)
+
     def fu_percentage(self):
         pot_size = self.pot_size()
         if pot_size == 0:
@@ -1248,6 +1255,13 @@ class PoFile(models.Model):
         else:
             return int(100*self.fuzzy/pot_size)
 
+    def fu_word_percentage(self):
+        pot_size = self.pot_size(words=True)
+        if pot_size == 0:
+            return 0
+        else:
+            return int(100*self.fuzzy_words/pot_size)
+
     def un_percentage(self):
         pot_size = self.pot_size()
         if pot_size == 0:
@@ -1255,6 +1269,13 @@ class PoFile(models.Model):
         else:
             return int(100*self.untranslated/pot_size)
 
+    def un_word_percentage(self):
+        pot_size = self.pot_size(words=True)
+        if pot_size == 0:
+            return 0
+        else:
+            return int(100*self.untranslated_words/pot_size)
+
     def update_stats(self):
         stats = utils.po_file_stats(self.path, msgfmt_checks=False)
         self.translated   = stats['translated']



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]