From 0b2cd5671291a20d741694dd5586ea9076dc10ae Mon Sep 17 00:00:00 2001 From: nek0 Date: Mon, 12 Oct 2015 16:34:03 +0200 Subject: [PATCH] fixed rounding bug in currencyField --- Handler/Common.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Handler/Common.hs b/Handler/Common.hs index cc48097..e708b8f 100755 --- a/Handler/Common.hs +++ b/Handler/Common.hs @@ -71,7 +71,7 @@ currencyField :: (RenderMessage (HandlerSite m) FormMessage, Show a, Monad m, In currencyField = Field { fieldParse = parseHelper $ \rawVals -> case R.double (prependZero rawVals) of - Right (a, "") -> Right $ floor $ 100 * a + Right (a, "") -> Right $ floor $ (100 * a) + 0.5 _ -> Left $ MsgInvalidNumber rawVals , fieldView = \theId name attr val req -> toWidget [hamlet|$newline never