From 3bf6df3b4955e81a6853157e711667a8ea8142fa Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 13 Aug 2023 12:11:33 -0400 Subject: [PATCH] FIX duplicated txs --- lib/Internal/Budget.hs | 5 ++--- lib/Internal/Database.hs | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Internal/Budget.hs b/lib/Internal/Budget.hs index 1411c65..f19126b 100644 --- a/lib/Internal/Budget.hs +++ b/lib/Internal/Budget.hs @@ -38,9 +38,8 @@ readBudget (intAllos, _) <- combineError intAlloRes acntRes (,) let res1 = mapErrors (readIncome c intAllos budgetSpan) bgtIncomes let res2 = expandTransfers c budgetSpan bgtTransfers - txs <- combineError (concat <$> res1) res2 (++) - shadow <- addShadowTransfers bgtShadowTransfers txs - return $ txs ++ shadow + combineErrorM (concat <$> res1) res2 $ \is ts -> + addShadowTransfers bgtShadowTransfers (is ++ ts) where c = CommitR (CommitHash $ hash b) CTBudget acntRes = mapErrors isNotIncomeAcnt alloAcnts diff --git a/lib/Internal/Database.hs b/lib/Internal/Database.hs index 3927b76..419c13a 100644 --- a/lib/Internal/Database.hs +++ b/lib/Internal/Database.hs @@ -81,6 +81,7 @@ sync pool root c bs hs = do liftIO $ print $ length $ coRead history liftIO $ print $ length $ coUpdate history liftIO $ print $ (\(DeleteTxs e a b c' d) -> (length e, length a, length b, length c', length d)) $ coDelete history + liftIO $ print $ fmap (length . snd) $ coCreate budgets' -- liftIO $ print $ length $ M.elems $ tsAccountMap txState -- liftIO $ print $ length $ M.elems $ tsCurrencyMap txState -- liftIO $ print $ length $ M.elems $ tsTagMap txState