Browse Source

List of Authors: added "# by commits" column.

Heikki Hokkanen 18 years ago
parent
commit
f9fa40d813
2 changed files with 7 additions and 4 deletions
  1. 0
    1
      doc/TODO.txt
  2. 7
    3
      gitstats

+ 0
- 1
doc/TODO.txt View File

36
 - Authors
36
 - Authors
37
 	- (T) List of authors
37
 	- (T) List of authors
38
 		- Lines
38
 		- Lines
39
-		- Position by nrof commits
40
 	- (T) Author of Month
39
 	- (T) Author of Month
41
 		- Lines
40
 		- Lines
42
 	- (T) Author of Year
41
 	- (T) Author of Year

+ 7
- 3
gitstats View File

32
 def getkeyssortedbyvalues(dict):
32
 def getkeyssortedbyvalues(dict):
33
 	return map(lambda el : el[1], sorted(map(lambda el : (el[1], el[0]), dict.items())))
33
 	return map(lambda el : el[1], sorted(map(lambda el : (el[1], el[0]), dict.items())))
34
 
34
 
35
-# TODO getdictkeyssortedbyvaluekey(dict, key) - eg. dict['author'] = { 'commits' : 512 } - ...key(dict, 'commits')
35
+# dict['author'] = { 'commits': 512 } - ...key(dict, 'commits')
36
+def getkeyssortedbyvaluekey(d, key):
37
+	return map(lambda el : el[1], sorted(map(lambda el : (d[el][key], el), d.keys())))
36
 
38
 
37
 class DataCollector:
39
 class DataCollector:
38
 	"""Manages data collection from a revision control repository."""
40
 	"""Manages data collection from a revision control repository."""
527
 		f.write(html_header(2, 'List of Authors'))
529
 		f.write(html_header(2, 'List of Authors'))
528
 
530
 
529
 		f.write('<table class="authors">')
531
 		f.write('<table class="authors">')
530
-		f.write('<tr><th>Author</th><th>Commits (%)</th><th>First commit</th><th>Last commit</th><th>Age</th></tr>')
532
+		f.write('<tr><th>Author</th><th>Commits (%)</th><th>First commit</th><th>Last commit</th><th>Age</th><th># by commits</th></tr>')
533
+		authors_by_commits = getkeyssortedbyvaluekey(data.authors, 'commits')
534
+		authors_by_commits.reverse() # most first
531
 		for author in sorted(data.getAuthors()):
535
 		for author in sorted(data.getAuthors()):
532
 			info = data.getAuthorInfo(author)
536
 			info = data.getAuthorInfo(author)
533
-			f.write('<tr><td>%s</td><td>%d (%.2f%%)</td><td>%s</td><td>%s</td><td>%s</td></tr>' % (author, info['commits'], info['commits_frac'], info['date_first'], info['date_last'], info['timedelta']))
537
+			f.write('<tr><td>%s</td><td>%d (%.2f%%)</td><td>%s</td><td>%s</td><td>%s</td><td>%d</td></tr>' % (author, info['commits'], info['commits_frac'], info['date_first'], info['date_last'], info['timedelta'], authors_by_commits.index(author) + 1))
534
 		f.write('</table>')
538
 		f.write('</table>')
535
 
539
 
536
 		# Authors :: Author of Month
540
 		# Authors :: Author of Month