null-error in sql-quert

This commit is contained in:
Nicole Dresselhaus 2016-11-14 01:10:55 +01:00
parent e31e76b76e
commit 2d0a23b8b4
Signed by: Drezil
GPG Key ID: 057D94F356F41E25

View File

@ -94,7 +94,7 @@ getUpdateR = loginOrDo (\(uid,user) -> do
_ -> return ()
--update stock-worth (cache)
let stocksql = "update \"user\" set \
stock_cents = (select sum(in_stock*price_cents) from transaction where \"user\"=\"user\".id and price_cents > 0 and in_stock > 0 and not trans_is_sell)\
stock_cents = COALESCE((select sum(in_stock*price_cents) from transaction where \"user\"=\"user\".id and price_cents > 0 and in_stock > 0 and not trans_is_sell),0)\
where id=?"
runDB $ rawExecute stocksql [toPersistValue uid]
--get current Orders