[damned-lies] More word methods. Now on Statistics class: {translated, fuzzy, untranslated}_words and {tr, fu, un}_wor



commit 03d8b4058794742b026f74a5ca45df65952db431
Author: Gil Forcada <gforcada gnome org>
Date:   Sat Oct 15 22:07:05 2011 +0200

    More word methods. Now on Statistics class: {translated,fuzzy,untranslated}_words and {tr,fu,un}_word_percentage methods

 stats/models.py |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index d8e6dfe..7fcc020 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -1324,12 +1324,21 @@ class Statistics(models.Model):
     def translated(self, scope='full'):
         return getattr(scope=='part' and self.part_po or self.full_po, 'translated', 0)
 
+    def translated_words(self, scope='full'):
+        return getattr(scope=='part' and self.part_po or self.full_po, 'translated_words', 0)
+
     def fuzzy(self, scope='full'):
         return getattr(scope=='part' and self.part_po or self.full_po, 'fuzzy', 0)
 
+    def fuzzy_words(self, scope='full'):
+        return getattr(scope=='part' and self.part_po or self.full_po, 'fuzzy_words', 0)
+
     def untranslated(self, scope='full'):
         return getattr(scope=='part' and self.part_po or self.full_po, 'untranslated', 0)
 
+    def untranslated_words(self, scope='full'):
+        return getattr(scope=='part' and self.part_po or self.full_po, 'untranslated_words', 0)
+
     def is_fake(self):
         return False
 
@@ -1343,6 +1352,13 @@ class Statistics(models.Model):
             return self.part_po.tr_percentage()
         return 0
 
+    def tr_word_percentage(self, scope='full'):
+        if scope == 'full' and self.full_po:
+            return self.full_po.tr_word_percentage()
+        elif scope == 'part' and self.part_po:
+            return self.part_po.tr_word_percentage()
+        return 0
+
     def fu_percentage(self, scope='full'):
         if scope == 'full' and self.full_po:
             return self.full_po.fu_percentage()
@@ -1350,6 +1366,13 @@ class Statistics(models.Model):
             return self.part_po.fu_percentage()
         return 0
 
+    def fu_word_percentage(self, scope='full'):
+        if scope == 'full' and self.full_po:
+            return self.full_po.fu_word_percentage()
+        elif scope == 'part' and self.part_po:
+            return self.part_po.fu_word_percentage()
+        return 0
+
     def un_percentage(self, scope='full'):
         if scope == 'full' and self.full_po:
             return self.full_po.un_percentage()
@@ -1357,6 +1380,13 @@ class Statistics(models.Model):
             return self.part_po.un_percentage()
         return 0
 
+    def un_word_percentage(self, scope='full'):
+        if scope == 'full' and self.full_po:
+            return self.full_po.un_word_percentage()
+        elif scope == 'part' and self.part_po:
+            return self.part_po.un_word_percentage()
+        return 0
+
     def get_lang(self):
         if not self.is_pot_stats():
             return _("%(lang_name)s (%(lang_locale)s)") % {



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