[damned-lies] Fixed doc figure stats (bug #724397)



commit a7bac16845c77619d0612b5d735804f80e8fde53
Author: Claude Paroz <claude 2xlibre net>
Date:   Sat Feb 15 11:17:59 2014 +0100

    Fixed doc figure stats (bug #724397)

 stats/models.py      |    4 ++--
 stats/tests/tests.py |    3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index cb701f1..82458db 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -518,7 +518,7 @@ class Branch(models.Model):
                                 continue
                         stat = Statistics.objects.create(language=language, branch=self, domain=dom)
 
-                    stat.update_stats(outpo, msgfmt_checks=True)
+                    stat.update_stats(outpo, pot_method, msgfmt_checks=True)
 
                     if linguas['langs'] is not None and lang not in linguas['langs']:
                         stat.set_error('warn-ext', linguas['error'])
@@ -1592,7 +1592,7 @@ class Statistics(models.Model):
 
         elif self.domain.dtype == "doc" and self.language is not None:
             fig_errors = utils.check_identical_figures(
-                fig_stats, self.branch.domain_path(self.domain), self.language)
+                fig_stats, self.branch.domain_path(self.domain), self.language.locale)
             for err in fig_errors:
                 stat.set_error(*err)
 
diff --git a/stats/tests/tests.py b/stats/tests/tests.py
index 020b5b6..76755c1 100644
--- a/stats/tests/tests.py
+++ b/stats/tests/tests.py
@@ -113,8 +113,11 @@ class ModuleTestCase(TestCase):
         self.branch.update_stats(force=True)
         fr_po_stat = Statistics.objects.get(branch=self.branch, domain__name='po', language__locale='fr')
         self.assertEqual(fr_po_stat.translated(), 44)
+        pot_doc_stat = Statistics.objects.get(branch=self.branch, domain__name='help', language=None)
+        self.assertEqual(len(pot_doc_stat.full_po.figures), 2)
         fr_doc_stat = Statistics.objects.get(branch=self.branch, domain__name='help', language__locale='fr')
         self.assertEqual(fr_doc_stat.translated(), 13)
+        self.assertEqual(len(pot_doc_stat.full_po.figures), len(fr_doc_stat.full_po.figures))
         self.assertEqual(fr_po_stat.po_url(), u"/POT/gnome-hello.master/gnome-hello.master.fr.po")
         self.assertEqual(fr_po_stat.pot_url(), u"/POT/gnome-hello.master/gnome-hello.master.pot")
         self.assertEqual(fr_doc_stat.po_url(), u"/POT/gnome-hello.master/docs/gnome-hello-help.master.fr.po")


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