From 2e3b51c03f5ae43a1c220aaabab57095b5591b50 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 19 Oct 2019 19:58:27 -0700 Subject: [PATCH] ;lib: journalConvertAmountsToCost -> journalToCost --- hledger-lib/Hledger/Data/Journal.hs | 6 +++--- hledger-lib/Hledger/Reports/BalanceReport.hs | 2 +- hledger-lib/Hledger/Reports/ReportOptions.hs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hledger-lib/Hledger/Data/Journal.hs b/hledger-lib/Hledger/Data/Journal.hs index 94b668308..95fd89fb8 100644 --- a/hledger-lib/Hledger/Data/Journal.hs +++ b/hledger-lib/Hledger/Data/Journal.hs @@ -24,7 +24,7 @@ module Hledger.Data.Journal ( journalApplyCommodityStyles, commodityStylesFromAmounts, journalCommodityStyles, - journalConvertAmountsToCost, + journalToCost, journalReverse, journalSetLastReadTime, journalPivot, @@ -1011,8 +1011,8 @@ canonicalStyleFrom ss@(s:_) = -- | Convert all this journal's amounts to cost using the transaction prices, if any. -- The journal's commodity styles are applied to the resulting amounts. -journalConvertAmountsToCost :: Journal -> Journal -journalConvertAmountsToCost j@Journal{jtxns=ts} = j{jtxns=map (transactionToCost styles) ts} +journalToCost :: Journal -> Journal +journalToCost j@Journal{jtxns=ts} = j{jtxns=map (transactionToCost styles) ts} where styles = journalCommodityStyles j diff --git a/hledger-lib/Hledger/Reports/BalanceReport.hs b/hledger-lib/Hledger/Reports/BalanceReport.hs index 2b31c42ee..0d22d76c2 100644 --- a/hledger-lib/Hledger/Reports/BalanceReport.hs +++ b/hledger-lib/Hledger/Reports/BalanceReport.hs @@ -413,7 +413,7 @@ tests_BalanceReport = tests "BalanceReport" [ ," a:b 10h @ $50" ," c:d " ]) >>= either error' return - let j' = journalCanonicaliseAmounts $ journalConvertAmountsToCost j -- enable cost basis adjustment + let j' = journalCanonicaliseAmounts $ journalToCost j -- enable cost basis adjustment balanceReportAsText defreportopts (balanceReport defreportopts Any j') `is` [" $500 a:b" ," $-500 c:d" diff --git a/hledger-lib/Hledger/Reports/ReportOptions.hs b/hledger-lib/Hledger/Reports/ReportOptions.hs index 02103a84d..87a24d724 100644 --- a/hledger-lib/Hledger/Reports/ReportOptions.hs +++ b/hledger-lib/Hledger/Reports/ReportOptions.hs @@ -416,7 +416,7 @@ flat_ = (==ALFlat) . accountlistmode_ journalSelectingAmountFromOpts :: ReportOpts -> Journal -> Journal journalSelectingAmountFromOpts opts = case value_ opts of - Just (AtCost _) -> journalConvertAmountsToCost + Just (AtCost _) -> journalToCost _ -> id -- | Convert report options and arguments to a query.