Skip to content

Commit fe1cc9c

Browse files
committed
Merge pull request burke-software#79 from SacNaturalFoods/row-totals-format-bug
Fixed row totals bug when incompatible format string is in effect.
2 parents dfa20d4 + 89ab95f commit fe1cc9c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

report_builder/views.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,14 @@ def increment_total(display_field_key, display_totals, val):
579579
value = Decimal(display_totals_row[df.position-1])
580580
except:
581581
value = display_totals_row[df.position-1]
582-
display_totals_row[df.position-1] = df.display_format.string.\
583-
format(value)
582+
# Fall back to original value if format string and value
583+
# aren't compatible, e.g. a numerically-oriented format
584+
# string with value which is not numeric.
585+
try:
586+
value = df.display_format.string.format(value)
587+
except ValueError:
588+
pass
589+
display_totals_row[df.position-1] = value
584590

585591
if display_totals:
586592
values_and_properties_list = (

0 commit comments

Comments
 (0)