hledger-iadd 1.3.10 → 1.3.11
raw patch · 4 files changed
+24/−9 lines, 4 filesdep ~hledger-libPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: hledger-lib
API changes (from Hackage documentation)
Files
- ChangeLog.md +5/−0
- hledger-iadd.cabal +4/−4
- src/Model.hs +2/−4
- src/View.hs +13/−1
ChangeLog.md view
@@ -1,3 +1,8 @@+# 1.3.11 [2020-06-04]++ - bugfix: Fix check for balanced transactions in the presence of commodities.+ - dependencies: Fix build with hledger-lib-1.18+ # 1.3.10 [2020-01-14] - dependencies: Support megaparsec-8
hledger-iadd.cabal view
@@ -1,5 +1,5 @@ name: hledger-iadd-version: 1.3.10+version: 1.3.11 synopsis: A terminal UI as drop-in replacement for hledger add description: This is a terminal UI as drop-in replacement for hledger add. .@@ -61,7 +61,7 @@ , Data.Time.Ext default-language: Haskell2010 build-depends: base >= 4.9 && < 5- , hledger-lib >= 1.14 && < 1.17+ , hledger-lib >= 1.14 && < 1.19 , brick >= 0.27 , vty >= 5.4 , text@@ -88,7 +88,7 @@ default-language: Haskell2010 build-depends: base >= 4.9 && < 5 , hledger-iadd- , hledger-lib >= 1.14 && < 1.17+ , hledger-lib >= 1.14 && < 1.19 , brick >= 0.27 , vty >= 5.4 , text@@ -116,7 +116,7 @@ default-language: Haskell2010 build-depends: base >= 4.9 && < 5 , hledger-iadd- , hledger-lib >= 1.14 && < 1.17+ , hledger-lib >= 1.14 && < 1.19 , text , transformers >= 0.3 , time >= 1.5
src/Model.hs view
@@ -276,14 +276,12 @@ -- | Returns True if all postings balance and the transaction is not empty transactionBalanced :: HL.Transaction -> Bool-transactionBalanced trans =- let (rsum, _, _) = HL.transactionPostingBalances trans- in HL.isZeroMixedAmount rsum+transactionBalanced trans = HL.isTransactionBalanced Nothing trans -- | Computes the sum of all postings in the transaction and inverts it negativeAmountSum :: HL.Transaction -> HL.MixedAmount negativeAmountSum trans =- let (rsum, _, _) = HL.transactionPostingBalances trans+ let rsum = HL.sumPostings $ HL.realPostings trans in HL.divideMixedAmount (-1) rsum -- | Compare two transaction descriptions based on their number of occurences in
src/View.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE CPP #-} module View ( viewState@@ -14,16 +15,27 @@ import Data.Semigroup ((<>)) import Data.Text (Text) import qualified Data.Text as T-import Data.Time hiding (parseTime) import qualified Hledger as HL +-- hledger-lib 1.17 will switch showTransaction to ISO date format, which means+-- that ISO dates yyyy-mm-dd will be added to the journal instead of yyyy/mm/dd.+--+-- Thus, for hledger-lib >=1.17, we also show the ISO format in the UI+#if !MIN_VERSION_hledger_lib(1,16,99)+import Data.Time hiding (parseTime)+#endif+ import Model viewState :: Step -> Widget n viewState (DateQuestion comment) = txt $ if T.null comment then " " else viewComment comment viewState (DescriptionQuestion date comment) = txt $+#if MIN_VERSION_hledger_lib(1,16,99)+ T.pack (show date)+#else T.pack (formatTime defaultTimeLocale "%Y/%m/%d" date)+#endif <> viewComment comment viewState (AccountQuestion trans comment) = txt $ showTransaction trans <> viewComment comment