Procházet zdrojové kódy

Added 'active days' for authors.

Shows how many days the author has done commits on.
Heikki Hokkanen před 16 roky
rodič
revize
e4c73e3680
1 změnil soubory, kde provedl 12 přidání a 3 odebrání
  1. 12
    3
      gitstats

+ 12
- 3
gitstats Zobrazit soubor

160
 		self.activity_by_hour_of_day_busiest = 0
160
 		self.activity_by_hour_of_day_busiest = 0
161
 		self.activity_by_hour_of_week_busiest = 0
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
 		# author of the month
165
 		# author of the month
166
 		self.author_of_month = {} # month -> author -> commits
166
 		self.author_of_month = {} # month -> author -> commits
304
 			else:
304
 			else:
305
 				self.commits_by_year[yy] = 1
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
 		# TODO Optimize this, it's the worst bottleneck
316
 		# TODO Optimize this, it's the worst bottleneck
308
 		# outputs "<stamp> <files>" for each revision
317
 		# outputs "<stamp> <files>" for each revision
309
 		self.files_by_stamp = {} # stamp -> files
318
 		self.files_by_stamp = {} # stamp -> files
665
 		f.write(html_header(2, 'List of Authors'))
674
 		f.write(html_header(2, 'List of Authors'))
666
 
675
 
667
 		f.write('<table class="authors sortable" id="authors">')
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
 		for author in sorted(data.getAuthors()):
678
 		for author in sorted(data.getAuthors()):
670
 			info = data.getAuthorInfo(author)
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
 		f.write('</table>')
681
 		f.write('</table>')
673
 
682
 
674
 		# Authors :: Author of Month
683
 		# Authors :: Author of Month