Ver código fonte

Actually pass floats when formatting '%f'.

Some of these were pointed out by Anonymous on SourceForge bug #2830659.
Heikki Hokkanen 16 anos atrás
pai
commit
d04805bbad
1 arquivos alterados com 3 adições e 3 exclusões
  1. 3
    3
      gitstats

+ 3
- 3
gitstats Ver arquivo

@@ -675,7 +675,7 @@ class HTMLReportCreator(ReportCreator):
675 675
 			authors.reverse()
676 676
 			commits = data.author_of_month[yymm][authors[0]]
677 677
 			next = ', '.join(authors[1:5])
678
-			f.write('<tr><td>%s</td><td>%s</td><td>%d (%.2f%% of %d)</td><td>%s</td></tr>' % (yymm, authors[0], commits, (100 * commits) / data.commits_by_month[yymm], data.commits_by_month[yymm], next))
678
+			f.write('<tr><td>%s</td><td>%s</td><td>%d (%.2f%% of %d)</td><td>%s</td></tr>' % (yymm, authors[0], commits, (100.0 * commits) / data.commits_by_month[yymm], data.commits_by_month[yymm], next))
679 679
 
680 680
 		f.write('</table>')
681 681
 
@@ -687,7 +687,7 @@ class HTMLReportCreator(ReportCreator):
687 687
 			authors.reverse()
688 688
 			commits = data.author_of_year[yy][authors[0]]
689 689
 			next = ', '.join(authors[1:5])
690
-			f.write('<tr><td>%s</td><td>%s</td><td>%d (%.2f%% of %d)</td><td>%s</td></tr>' % (yy, authors[0], commits, (100 * commits) / data.commits_by_year[yy], data.commits_by_year[yy], next))
690
+			f.write('<tr><td>%s</td><td>%s</td><td>%d (%.2f%% of %d)</td><td>%s</td></tr>' % (yy, authors[0], commits, (100.0 * commits) / data.commits_by_year[yy], data.commits_by_year[yy], next))
691 691
 		f.write('</table>')
692 692
 
693 693
 		f.write('</body></html>')
@@ -762,7 +762,7 @@ class HTMLReportCreator(ReportCreator):
762 762
 		f.write('<dl>')
763 763
 		f.write('<dt>Total tags</dt><dd>%d</dd>' % len(data.tags))
764 764
 		if len(data.tags) > 0:
765
-			f.write('<dt>Average commits per tag</dt><dd>%.2f</dd>' % (data.getTotalCommits() / len(data.tags)))
765
+			f.write('<dt>Average commits per tag</dt><dd>%.2f</dd>' % (1.0 * data.getTotalCommits() / len(data.tags)))
766 766
 		f.write('</dl>')
767 767
 
768 768
 		f.write('<table>')