fixed bug in supplier digest where crates could become negative
This commit is contained in:
parent
303c2716f1
commit
8375041ad7
1 changed files with 7 additions and 2 deletions
|
@ -48,7 +48,7 @@ getSupplierDigestR sId = do
|
||||||
<th>_{MsgPricePerCrate}
|
<th>_{MsgPricePerCrate}
|
||||||
<th>_{MsgTotalValue}
|
<th>_{MsgTotalValue}
|
||||||
$forall dig <- digests
|
$forall dig <- digests
|
||||||
$if bdCrates dig > 0
|
$if bdCrates dig /= 0
|
||||||
<tr>
|
<tr>
|
||||||
<td>#{fromMaybe "" $ beverageArtNr $ bdBev dig}
|
<td>#{fromMaybe "" $ beverageArtNr $ bdBev dig}
|
||||||
<td>#{beverageIdent $ bdBev dig}
|
<td>#{beverageIdent $ bdBev dig}
|
||||||
|
@ -87,7 +87,12 @@ genBevDigest bev =
|
||||||
BevDigest amount (amount * (fromMaybe 0 $ beveragePricePerCrate $ entityVal bev)) (entityVal bev)
|
BevDigest amount (amount * (fromMaybe 0 $ beveragePricePerCrate $ entityVal bev)) (entityVal bev)
|
||||||
where
|
where
|
||||||
amount =
|
amount =
|
||||||
((beverageMaxAmount (entityVal bev) - beverageAmount (entityVal bev)) `div` ( fromMaybe 1 $ beveragePerCrate (entityVal bev)))
|
if ((beverageMaxAmount (entityVal bev) - beverageAmount (entityVal bev)) `div` (fromMaybe 1 $ beveragePerCrate (entityVal bev))) < 0
|
||||||
|
then
|
||||||
|
0
|
||||||
|
else
|
||||||
|
((beverageMaxAmount (entityVal bev) - beverageAmount (entityVal bev)) `div` (fromMaybe 1 $ beveragePerCrate (entityVal bev)))
|
||||||
|
|
||||||
|
|
||||||
getDeleteSupplierR :: SupplierId -> Handler Html
|
getDeleteSupplierR :: SupplierId -> Handler Html
|
||||||
getDeleteSupplierR sId = do
|
getDeleteSupplierR sId = do
|
||||||
|
|
Loading…
Reference in a new issue