Skip to content

Commit

Permalink
avoid divide by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
bassettb committed Sep 2, 2018
1 parent 6dac164 commit 55c89a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/report_plugins/daytoday.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ daytoday.report = function report_daytoday(datastorage,sorteddaystoshow,options)
if (treatment.carbs && options.carbs) {
var ic = profile.getCarbRatio(new Date(treatment.mills));
var dataLabel = treatment.carbs + ' g';
if (showInsulinUnitsWithCarbTreatment)
if (showInsulinUnitsWithCarbTreatment && ic > 0)
dataLabel += ' (' + (Math.round((treatment.carbs/ic)*100)/100) + ' U)';
context.append('rect')
.attr('y',yCarbsScale(treatment.carbs))
Expand Down

0 comments on commit 55c89a3

Please sign in to comment.