Show More
@@ -154,11 +154,9 b' class SummaryController(BaseRepoControll' | |||
|
154 | 154 | "desc": LANGUAGES_EXTENSIONS_MAP.get(x)}) |
|
155 | 155 | for x, y in lang_stats_d.items()) |
|
156 | 156 | |
|
157 |
c.trending_languages = json.dumps( |
|
|
158 |
|
|
|
159 | key=lambda k: k[1])[:10] | |
|
160 | ) | |
|
161 | ) | |
|
157 | c.trending_languages = json.dumps( | |
|
158 | sorted(lang_stats, reverse=True, key=lambda k: k[1])[:10] | |
|
159 | ) | |
|
162 | 160 | last_rev = stats.stat_on_revision + 1 |
|
163 | 161 | c.repo_last_rev = c.rhodecode_repo.count()\ |
|
164 | 162 | if c.rhodecode_repo.revisions else 0 |
@@ -87,6 +87,7 b' class _Nil(object):' | |||
|
87 | 87 | |
|
88 | 88 | _nil = _Nil() |
|
89 | 89 | |
|
90 | ||
|
90 | 91 | class _odict(object): |
|
91 | 92 | """Ordered dict data structure, with O(1) complexity for dict operations |
|
92 | 93 | that modify one element. |
@@ -146,7 +147,7 b' class _odict(object):' | |||
|
146 | 147 | dict_impl = self._dict_impl() |
|
147 | 148 | try: |
|
148 | 149 | dict_impl.__getitem__(self, key)[1] = val |
|
149 |
except KeyError |
|
|
150 | except KeyError: | |
|
150 | 151 | new = [dict_impl.__getattribute__(self, 'lt'), val, _nil] |
|
151 | 152 | dict_impl.__setitem__(self, key, new) |
|
152 | 153 | if dict_impl.__getattribute__(self, 'lt') == _nil: |
@@ -158,7 +159,7 b' class _odict(object):' | |||
|
158 | 159 | |
|
159 | 160 | def __delitem__(self, key): |
|
160 | 161 | dict_impl = self._dict_impl() |
|
161 |
pred, _ |
|
|
162 | pred, _, succ = self._dict_impl().__getitem__(self, key) | |
|
162 | 163 | if pred == _nil: |
|
163 | 164 | dict_impl.__setattr__(self, 'lh', succ) |
|
164 | 165 | else: |
@@ -351,6 +352,7 b' class _odict(object):' | |||
|
351 | 352 | dict_impl.__getattribute__(self, 'lt'), |
|
352 | 353 | dict_impl.__repr__(self)) |
|
353 | 354 | |
|
355 | ||
|
354 | 356 | class OrderedDict(_odict, dict): |
|
355 | 357 | |
|
356 | 358 | def _dict_impl(self): |
@@ -295,33 +295,35 b" YUE.on(['download_options','archive_subr" | |||
|
295 | 295 | var data = ${c.trending_languages|n}; |
|
296 | 296 | var total = 0; |
|
297 | 297 | var no_data = true; |
|
298 | for (k in data){ | |
|
299 | total += data[k].count; | |
|
300 | no_data = false; | |
|
301 | } | |
|
302 | 298 | var tbl = document.createElement('table'); |
|
303 | 299 | tbl.setAttribute('class','trending_language_tbl'); |
|
304 | 300 | var cnt = 0; |
|
305 | for (k in data){ | |
|
301 | ||
|
302 | for (var i=0;i<data.length;i++){ | |
|
303 | total += data[i][1].count; | |
|
306 | 304 | cnt += 1; |
|
305 | no_data = false; | |
|
306 | ||
|
307 | 307 | var hide = cnt>2; |
|
308 | 308 | var tr = document.createElement('tr'); |
|
309 | 309 | if (hide){ |
|
310 | 310 | tr.setAttribute('style','display:none'); |
|
311 | 311 | tr.setAttribute('class','stats_hidden'); |
|
312 | 312 | } |
|
313 | var percentage = Math.round((data[k].count/total*100),2); | |
|
314 |
var |
|
|
313 | var k = data[i][0]; | |
|
314 | var obj = data[i][1]; | |
|
315 | var percentage = Math.round((obj.count/total*100),2); | |
|
316 | ||
|
315 | 317 | var td1 = document.createElement('td'); |
|
316 | 318 | td1.width = 150; |
|
317 | 319 | var trending_language_label = document.createElement('div'); |
|
318 |
trending_language_label.innerHTML = |
|
|
320 | trending_language_label.innerHTML = obj.desc+" ("+k+")"; | |
|
319 | 321 | td1.appendChild(trending_language_label); |
|
320 | 322 | |
|
321 | 323 | var td2 = document.createElement('td'); |
|
322 | 324 | td2.setAttribute('style','padding-right:14px !important'); |
|
323 | 325 | var trending_language = document.createElement('div'); |
|
324 |
var nr_files = |
|
|
326 | var nr_files = obj.count+" ${_('files')}"; | |
|
325 | 327 | |
|
326 | 328 | trending_language.title = k+" "+nr_files; |
|
327 | 329 |
General Comments 0
You need to be logged in to leave comments.
Login now