[damned-lies] Select appropriate domains when getting branch stats
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Select appropriate domains when getting branch stats
- Date: Fri, 2 Oct 2015 07:49:24 +0000 (UTC)
commit acd5680ba7b7492e5554dfe7db80cf931f663639
Author: Claude Paroz <claude 2xlibre net>
Date: Fri Oct 2 09:48:52 2015 +0200
Select appropriate domains when getting branch stats
stats/models.py | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index 46037f6..d3daa71 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -372,15 +372,17 @@ class Branch(models.Model):
'po-tips': [potstat, polang1, polang2, ...]}
mandatory_langs is a list of language objects whose stats should be added even if no translation
exists.
"""
- stats = OrderedDict(); stats_langs = {}
+ stats = OrderedDict()
+ stats_langs = {}
+ domain_pks = [d.pk for d in self.get_domains().values() if d.dtype == typ]
pot_stats = Statistics.objects.select_related("language", "domain", "branch", "full_po"
- ).filter(branch=self, language__isnull=True, domain__dtype=typ
+ ).filter(branch=self, language__isnull=True, domain__pk__in=domain_pks
).order_by('domain__name')
for stat in pot_stats.all():
stats[stat.domain.name] = [stat,]
stats_langs[stat.domain.name] = []
tr_stats = Statistics.objects.select_related("language", "domain", "branch", "full_po"
- ).filter(branch=self, language__isnull=False, domain__dtype=typ)
+ ).filter(branch=self, language__isnull=False, domain__pk__in=domain_pks)
for stat in tr_stats.all():
stats[stat.domain.name].append(stat)
stats_langs[stat.domain.name].append(stat.language)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]