changeset 1258:3954bdaf6243 beta

fixed possible float division, and changeset ranges bug introduced in stat changeset.
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 14 Apr 2011 01:07:18 +0200
parents 0a2a10a1912f
children 4209cd4b7823
files rhodecode/lib/helpers.py rhodecode/templates/changeset/changeset_range.html
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/helpers.py	Thu Apr 14 00:43:23 2011 +0200
+++ b/rhodecode/lib/helpers.py	Thu Apr 14 01:07:18 2011 +0200
@@ -644,8 +644,9 @@
 
 def fancy_file_stats(stats):
     a, d, t = stats[0], stats[1], stats[0] + stats[1]
+    print stats
     width = 100
-    unit = float(width) / t
+    unit = float(width) / (t or 1)
 
     a_p = max(9, unit * a) if a > 0 else 0# needs > 9% to be visible
     d_p = max(9, unit * d) if d > 0 else 0 # needs > 9% to be visible
--- a/rhodecode/templates/changeset/changeset_range.html	Thu Apr 14 00:43:23 2011 +0200
+++ b/rhodecode/templates/changeset/changeset_range.html	Thu Apr 14 01:07:18 2011 +0200
@@ -53,7 +53,7 @@
 	        <div class="cs_files">
 	               %for cs in c.cs_ranges:
 	                   <div class="cur_cs">r${cs}</div>
-	                %for change,filenode,diff,cs1,cs2 in c.changes[cs.raw_id]:
+	                %for change,filenode,diff,cs1,cs2,st in c.changes[cs.raw_id]:
 	                    <div class="cs_${change}">${h.link_to(h.safe_unicode(filenode.path),h.url.current(anchor=h.repo_name_slug('C%s-%s' % (cs.short_id,h.safe_unicode(filenode.path)))))}</div>
 	                %endfor
 	               %endfor 
@@ -62,7 +62,7 @@
 	    
     </div>
    %for cs in c.cs_ranges:    	
-	%for change,filenode,diff,cs1,cs2 in c.changes[cs.raw_id]:
+	%for change,filenode,diff,cs1,cs2,st in c.changes[cs.raw_id]:
 		%if change !='removed':
 		<div style="clear:both;height:10px"></div>
 		<div class="diffblock">