Merge pull request #84 from astro/transactionize

Handler.Buy: transactionize postBuyR runDB
This commit is contained in:
rys ostrovid 2016-01-26 18:14:23 +01:00
commit 54f3b0d89e

View file

@ -51,8 +51,9 @@ postBuyR uId bId = do
else do
let price = quant * (beveragePrice bev)
let sw = price > (userBalance user)
runDB $ update uId [UserBalance -=. price]
runDB $ update bId [BeverageAmount -=. quant]
runDB $ do
update uId [UserBalance -=. price]
update bId [BeverageAmount -=. quant]
checkAlert bId
master <- getYesod
liftIO $ notifyUser user bev price master