mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 07:09:28 +03:00
web: fix warnings
This commit is contained in:
parent
b0d74b1466
commit
b42298c1e2
@ -6,7 +6,6 @@ import Import
|
||||
|
||||
import Handler.Common
|
||||
import Handler.Post
|
||||
import Handler.Utils
|
||||
|
||||
|
||||
-- | The journal editform, no sidebar.
|
||||
|
@ -65,17 +65,17 @@ handleAdd = do
|
||||
, isRight en
|
||||
, let Right n = en
|
||||
]
|
||||
num = length acctparams
|
||||
paramErrs | not $ length amtparams `elem` [num, num-1] = ["different number of account and amount parameters"]
|
||||
num' = length acctparams
|
||||
paramErrs | not $ length amtparams `elem` [num', num'-1] = ["different number of account and amount parameters"]
|
||||
| otherwise = catMaybes
|
||||
[if map fst acctparams == [1..num] then Nothing else Just "misnumbered account parameters"
|
||||
,if map fst amtparams == [1..num] || map fst amtparams == [1..(num-1)] then Nothing else Just "misnumbered amount parameters"
|
||||
[if map fst acctparams == [1..num'] then Nothing else Just "misnumbered account parameters"
|
||||
,if map fst amtparams == [1..num'] || map fst amtparams == [1..(num'-1)] then Nothing else Just "misnumbered amount parameters"
|
||||
]
|
||||
eaccts = map (parsewith (accountnamep <* eof) . strip . T.unpack . snd) acctparams
|
||||
eamts = map (parseWithCtx nullctx (amountp <* eof) . strip . T.unpack . snd) amtparams
|
||||
(accts, acctErrs) = (rights eaccts, map show $ lefts eaccts)
|
||||
(amts', amtErrs) = (rights eamts, map show $ lefts eamts)
|
||||
amts | length amts' == num = amts'
|
||||
amts | length amts' == num' = amts'
|
||||
| otherwise = amts' ++ [missingamt]
|
||||
|
||||
-- if no errors so far, generate a transaction and balance it or get the error.
|
||||
|
Loading…
Reference in New Issue
Block a user