[damned-lies] Ignore exotic languages in old branches



commit e999d7c820591039608280043f231573088e4074
Author: Claude Paroz <claude 2xlibre net>
Date:   Tue Aug 25 13:43:53 2009 +0200

    Ignore exotic languages in old branches

 stats/models.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index 31657f9..790b653 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -422,8 +422,12 @@ class Branch(models.Model):
                     try:
                         language = Language.objects.get(locale=lang)
                     except Language.DoesNotExist:
-                        language = Language(name=lang, locale=lang)
-                        language.save()
+                        if self.is_head():
+                            language = Language(name=lang, locale=lang)
+                            language.save()
+                        else:
+                            # Do not create language (and therefore ignore stats) for an 'old' branch
+                            continue
                     stat = Statistics(language = language, branch = self, domain = dom, translated = int(langstats['translated']),
                                       fuzzy = int(langstats['fuzzy']), untranslated = int(langstats['untranslated']))
                 stat.save()



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