Browse files

a better fix for the previous commit.

  • Loading branch information...
1 parent 7897711 commit 9aaa63caa602f69ba4cbefd16dfcfd78566a9add @mrjbq7 mrjbq7 committed Oct 20, 2012
Showing with 7 additions and 7 deletions.
  1. +2 −2 tracstats/templates/code.html
  2. +5 −5 tracstats/web_ui.py
View
4 tracstats/templates/code.html
@@ -247,13 +247,13 @@
<tr>
<td width="150"><a href="${stat.url}">${stat.name}</a></td>
<td width="420" align="right">
-<span id="author${stat.id}">Loading...</span>
+<span id="byauthor${stat.id}">Loading...</span>
<script language="javascript" type="text/javascript">
$(document).ready(function()
{
var values = [<py:for each="week in stat.weeks">${week.total}<py:if
test="week != stat.weeks[-1]">,</py:if></py:for>];
- $("[id=author${stat.id}]").sparkline(values, {
+ $("#byauthor${stat.id}").sparkline(values, {
type: "bar",
barColor: "lightgray",
barWidth: 7,
View
10 tracstats/web_ui.py
@@ -321,9 +321,8 @@ def _process(self, req, cursor, where, data):
rows = cursor.fetchall()
stats = []
- for i, (author, commits) in enumerate(rows):
- stats.append({'id': i,
- 'name': author,
+ for author, commits in rows:
+ stats.append({'name': author,
'url': req.href.stats("code", author=author),})
data['byauthors'] = stats
@@ -520,7 +519,7 @@ def _process_code(self, req, cursor, where, data):
d[author] = { week : 1 }
stats = []
- for author in sorted(set(author for _, _, author, _, _ in revisions)):
+ for i, author in enumerate(sorted(set(author for _, _, author, _, _ in revisions))):
commits = len(set(x[0] for x in revisions if x[2] == author))
mintime = min(x[1] for x in revisions if x[2] == author)
maxtime = max(x[1] for x in revisions if x[2] == author)
@@ -545,7 +544,8 @@ def _process_code(self, req, cursor, where, data):
if week < 0:
year -= 1
week = 52
- stats.append({'name': author,
+ stats.append({'id': i,
+ 'name': author,
'url': req.href.stats("code", author=author),
'commits': commits,
'rate': '%.2f' % (rate and float(rate) or 0),

0 comments on commit 9aaa63c

Please sign in to comment.