let the function get the time itself

This commit is contained in:
nek0 2019-08-09 20:55:40 +02:00
parent 6fa47c0e1e
commit 9f78818687
2 changed files with 18 additions and 18 deletions

View file

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

View file

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