Sfoglia il codice sorgente

Added 'active days' for authors.

Shows how many days the author has done commits on.
Heikki Hokkanen 16 anni fa
parent
commit
e4c73e3680
1 ha cambiato i file con 12 aggiunte e 3 eliminazioni
  1. 12
    3
      gitstats

+ 12
- 3
gitstats Vedi File

@@ -160,7 +160,7 @@ class GitDataCollector(DataCollector):
160 160
 		self.activity_by_hour_of_day_busiest = 0
161 161
 		self.activity_by_hour_of_week_busiest = 0
162 162
 
163
-		self.authors = {} # name -> {commits, first_commit_stamp, last_commit_stamp}
163
+		self.authors = {} # name -> {commits, first_commit_stamp, last_commit_stamp, last_active_day, active_days}
164 164
 
165 165
 		# author of the month
166 166
 		self.author_of_month = {} # month -> author -> commits
@@ -304,6 +304,15 @@ class GitDataCollector(DataCollector):
304 304
 			else:
305 305
 				self.commits_by_year[yy] = 1
306 306
 
307
+			# authors: active days
308
+			yymmdd = datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m-%d')
309
+			if 'last_active_day' not in self.authors[author]:
310
+				self.authors[author]['last_active_day'] = yymmdd
311
+				self.authors[author]['active_days'] = 1
312
+			elif yymmdd != self.authors[author]['last_active_day']:
313
+				self.authors[author]['last_active_day'] = yymmdd
314
+				self.authors[author]['active_days'] += 1
315
+
307 316
 		# TODO Optimize this, it's the worst bottleneck
308 317
 		# outputs "<stamp> <files>" for each revision
309 318
 		self.files_by_stamp = {} # stamp -> files
@@ -665,10 +674,10 @@ class HTMLReportCreator(ReportCreator):
665 674
 		f.write(html_header(2, 'List of Authors'))
666 675
 
667 676
 		f.write('<table class="authors sortable" id="authors">')
668
-		f.write('<tr><th>Author</th><th>Commits (%)</th><th>First commit</th><th>Last commit</th><th class="unsortable">Age</th><th># by commits</th></tr>')
677
+		f.write('<tr><th>Author</th><th>Commits (%)</th><th>First commit</th><th>Last commit</th><th class="unsortable">Age</th><th>Active days</th><th># by commits</th></tr>')
669 678
 		for author in sorted(data.getAuthors()):
670 679
 			info = data.getAuthorInfo(author)
671
-			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'], info['place_by_commits']))
680
+			f.write('<tr><td>%s</td><td>%d (%.2f%%)</td><td>%s</td><td>%s</td><td>%s</td><td>%d</td><td>%d</td></tr>' % (author, info['commits'], info['commits_frac'], info['date_first'], info['date_last'], info['timedelta'], info['active_days'], info['place_by_commits']))
672 681
 		f.write('</table>')
673 682
 
674 683
 		# Authors :: Author of Month