let the function get the time itself

This commit is contained in:
nek0 2019-08-09 20:55:40 +02:00
parent 573d2af0df
commit 5280255ddc
2 changed files with 18 additions and 18 deletions

View file

@ -184,9 +184,8 @@ userList muid ref = do
productNew :: Maybe Int -> ProductSubmit -> MateHandler Int productNew :: Maybe Int -> ProductSubmit -> MateHandler Int
productNew (Just _) bevsub = do productNew (Just _) bevsub = do
conn <- rsConnection <$> ask conn <- rsConnection <$> ask
now <- liftIO $ getCurrentTime
bevid <- insertProduct bevsub conn bevid <- insertProduct bevsub conn
void $ insertNewEmptyAmount bevid now bevsub conn void $ insertNewEmptyAmount bevid bevsub conn
return bevid return bevid
productNew Nothing _ = productNew Nothing _ =
throwError $ err403 throwError $ err403

View file

@ -56,12 +56,13 @@ amountTable = table "amount" (
insertNewEmptyAmount insertNewEmptyAmount
:: Int -- | the associated product id :: Int -- | the associated product id
-> UTCTime -- | current time
-> ProductSubmit -- | submitted product data -> ProductSubmit -- | submitted product data
-> PGS.Connection -> PGS.Connection
-> MateHandler Int -> MateHandler Int
insertNewEmptyAmount bevid now (ProductSubmit _ price _ _ _ _ _ _ _) conn = insertNewEmptyAmount bevid (ProductSubmit _ price _ _ _ _ _ _ _) conn =
fmap head $ liftIO $ runInsert_ conn $ Insert liftIO $ do
now <- getCurrentTime
fmap head $ runInsert_ conn $ Insert
{ iTable = amountTable { iTable = amountTable
, iRows = , iRows =
[ [