mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-25 19:31:44 +03:00
lib,cli: Fix ledgerDateSpan, so that in takes transaction dates into account.
This commit is contained in:
parent
5fbb67b893
commit
edbb713cf8
@ -31,9 +31,7 @@ import Text.Printf
|
||||
import Hledger.Utils.Test
|
||||
import Hledger.Data.Types
|
||||
import Hledger.Data.Account
|
||||
import Hledger.Data.Dates (daysSpan)
|
||||
import Hledger.Data.Journal
|
||||
import Hledger.Data.Posting (postingDate)
|
||||
import Hledger.Query
|
||||
|
||||
|
||||
@ -94,7 +92,7 @@ ledgerPostings = journalPostings . ljournal
|
||||
-- | The (fully specified) date span containing all the ledger's (filtered) transactions,
|
||||
-- or DateSpan Nothing Nothing if there are none.
|
||||
ledgerDateSpan :: Ledger -> DateSpan
|
||||
ledgerDateSpan = daysSpan . map postingDate . ledgerPostings
|
||||
ledgerDateSpan = journalDateSpanBothDates . ljournal
|
||||
|
||||
-- | All commodities used in this ledger.
|
||||
ledgerCommodities :: Ledger -> [CommoditySymbol]
|
||||
|
@ -46,7 +46,7 @@ stats opts@CliOpts{reportspec_=rspec} j = do
|
||||
d <- getCurrentDay
|
||||
let q = rsQuery rspec
|
||||
l = ledgerFromJournal q j
|
||||
reportspan = (ledgerDateSpan l) `spanDefaultsFrom` (queryDateSpan False q)
|
||||
reportspan = ledgerDateSpan l `spanDefaultsFrom` queryDateSpan False q
|
||||
intervalspans = splitSpan (interval_ $ rsOpts rspec) reportspan
|
||||
showstats = showLedgerStats l d
|
||||
s = intercalate "\n" $ map showstats intervalspans
|
||||
|
Loading…
Reference in New Issue
Block a user