[damned-lies] Simplify dict key (and allow proper int sorting)



commit 95dee435e7dab9e18eded68db59794f6ab7f94ed
Author: Claude Paroz <claude 2xlibre net>
Date:   Sat Dec 15 20:07:30 2012 +0100

    Simplify dict key (and allow proper int sorting)

 stats/models.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index 9965691..1605d05 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -1606,8 +1606,8 @@ class Statistics(models.Model):
                 'totaltransperc': 0,
                 'totalfuzzyperc': 0,
                 'totaluntransperc': 0,
-                'categs': {
-                    <categname>: {
+                'categs': {  # SortedDict
+                    <categkey>: {
                         'catname': <catname>, # translated category name (see CATEGORY_CHOICES)
                         'cattotal': 0,
                         'cattrans': 0,
@@ -1674,7 +1674,7 @@ class Statistics(models.Model):
         for stat in pot_stats:
             categ_key = "default"
             if release:
-                categ_key = '%d-%s' % (category_choices_dict.keys().index(stat.categ_name), stat.categ_name)
+                categ_key = category_choices_dict.keys().index(stat.categ_name)
             domname = stat.domain.description and _(stat.domain.description) or ""
             branchname = stat.branch.name
             modname = stat.branch.module.name



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