From 2d0a23b8b4185ce20aa0cda310988d909f35837f Mon Sep 17 00:00:00 2001 From: Stefan Dresselhaus Date: Mon, 14 Nov 2016 01:10:55 +0100 Subject: [PATCH] null-error in sql-quert --- Handler/Update.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Handler/Update.hs b/Handler/Update.hs index e549b51..90f0ad5 100644 --- a/Handler/Update.hs +++ b/Handler/Update.hs @@ -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