Don't create empty future carbs records. Fixes #940.
When very few carbs are stretched out (e.g. 10g over 4h), there are gaps, so that 1g is generated only every 30m. Don't create empty records in between.
This commit is contained in:
parent
73d7d98354
commit
8c3df40fdf
1 changed files with 2 additions and 1 deletions
|
@ -403,6 +403,7 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C
|
|||
long carbTime = time + i * 15 * 60 * 1000;
|
||||
long smallCarbAmount = Math.round((1d * remainingCarbs) / (ticks-i)); //on last iteration (ticks-i) is 1 -> smallCarbAmount == remainingCarbs
|
||||
remainingCarbs -= smallCarbAmount;
|
||||
if (smallCarbAmount > 0)
|
||||
createCarb(smallCarbAmount, carbTime, notes);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue