matthewkris / mibrew-issues

This is an empty repo used to host the public MIBrew issue tracker.
https://www.mibrewsupply.com/recipe
0 stars 0 forks source link

Buy Ingredient Update #8

Closed matthewkris closed 5 years ago

matthewkris commented 5 years ago

Currently if a recipe calls for X lbs of DME the add to cart will add X 1 lb bags. It should add:

Examples:

7 lbs

2x - 3lb bags 1x - 1lb bag

#!php

$total = 8.75;
$three = floor($total / 3); // 2 
$one = ceil($total - ($three * 3)); // 3

if($one == 3)  { // if $one is 3
    $one = 0;
    $three++;
}
matthewkris commented 5 years ago

This was updated and pushed to production on 3/3/2019