This commit is contained in:
nek0 2020-09-16 17:54:42 +02:00
parent 64547d3d16
commit 998474640c

View file

@ -7,9 +7,9 @@ import Control.Monad (void)
import Control.Monad.Reader (asks) import Control.Monad.Reader (asks)
import Control.Monad.Extra (anyM) import Control.Monad.Extra (anyM, allM)
import Data.Maybe (fromMaybe) import Data.Maybe (fromMaybe, isJust)
-- internal imports -- internal imports
@ -56,10 +56,11 @@ productStockRefill (Just (uid, auth)) amorefs = do
if auth `elem` [PrimaryPass, ChallengeResponse] && mayRefill if auth `elem` [PrimaryPass, ChallengeResponse] && mayRefill
then do then do
conn <- asks rsConnection conn <- asks rsConnection
prods <- mapM let prods = map
(\refill -> productSelectSingle (amountRefillProductId refill) conn) (\refill -> productSelectSingle (amountRefillProductId refill) conn)
amorefs amorefs
if not (any null prods) allProdsExist <- allM (fmap isJust) prods
if allProdsExist
then then
if if
all all