Skip to content

Commit

Permalink
Fix bug in adding units to strings for metric
Browse files Browse the repository at this point in the history
  • Loading branch information
lowrie committed Oct 19, 2015
1 parent 37961b4 commit 819850b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,12 @@ def inches_to_intervals(self, inches_):
def intervals_to_string(self, intervals, with_units=False):
'''A string representation of the value intervals'''
if self.metric:
return '%d' % intervals
whole = int(intervals / self.intervals_per_inch)
numer = intervals - self.intervals_per_inch * whole
denom = self.intervals_per_inch
r = My_Fraction(whole, numer, denom).to_string()
r = '%d' % intervals
else:
whole = int(intervals / self.intervals_per_inch)
numer = intervals - self.intervals_per_inch * whole
denom = self.intervals_per_inch
r = My_Fraction(whole, numer, denom).to_string()
if with_units:
r += self.units_string()
return r
Expand Down

0 comments on commit 819850b

Please sign in to comment.