Przeglądaj źródła

Sort authors by name.

Heikki Hokkanen 18 lat temu
rodzic
commit
1abf9527c4
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3
    1
      statgit

+ 3
- 1
statgit Wyświetl plik

@@ -15,6 +15,8 @@ def getoutput(cmd):
15 15
 def getkeyssortedbyvalues(dict):
16 16
 	return map(lambda el : el[1], sorted(map(lambda el : (el[1], el[0]), dict.items())))
17 17
 
18
+# TODO getdictkeyssortedbyvaluekey(dict, key) - eg. dict['author'] = { 'commits' : 512 } - ...key(dict, 'commits')
19
+
18 20
 class DataCollector:
19 21
 	def __init__(self):
20 22
 		pass
@@ -324,7 +326,7 @@ class HTMLReportCreator(ReportCreator):
324 326
 
325 327
 		f.write('<table class="authors">')
326 328
 		f.write('<tr><th>Author</th><th>Commits (%)</th><th>First commit</th><th>Last commit</th></tr>')
327
-		for author in data.getAuthors():
329
+		for author in sorted(data.getAuthors()):
328 330
 			info = data.getAuthorInfo(author)
329 331
 			f.write('<tr><td>%s</td><td>%d (%.2f%%)</td><td>%s</td><td>%s</td></tr>' % (author, info['commits'], info['commits_frac'], info['date_first'], info['date_last']))
330 332
 		f.write('</table>')