From 6a62bd6437c25b06ae936d6db90a207a38942bfa Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 10 Jun 2019 17:24:50 -0700 Subject: [PATCH] web, api: update for MarketPrice/PriceDirective change --- hledger-api/hledger-api.hs | 2 +- hledger-lib/Hledger/Data/Prices.hs | 1 + hledger-web/Hledger/Web/Handler/MiscR.hs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hledger-api/hledger-api.hs b/hledger-api/hledger-api.hs index c9df03089ee..14473b8bf49 100644 --- a/hledger-api/hledger-api.hs +++ b/hledger-api/hledger-api.hs @@ -152,7 +152,7 @@ hledgerApiApp staticdir j = Servant.serve api server where accountnamesH = return $ journalAccountNames j transactionsH = return $ jtxns j - pricesH = return $ jpricedirectives j + pricesH = return $ map priceDirectiveToMarketPrice $ jpricedirectives j commoditiesH = return $ (M.keys . jinferredcommodities) j accountsH = return $ ledgerTopAccounts $ ledgerFromJournal Hledger.Query.Any j accounttransactionsH (a::AccountName) = do diff --git a/hledger-lib/Hledger/Data/Prices.hs b/hledger-lib/Hledger/Data/Prices.hs index 1e318515e2e..b0b04cf0535 100644 --- a/hledger-lib/Hledger/Data/Prices.hs +++ b/hledger-lib/Hledger/Data/Prices.hs @@ -16,6 +16,7 @@ module Hledger.Data.Prices ( ,mixedAmountValueAtDate ,mixedAmountApplyValuation ,priceLookup + ,priceDirectiveToMarketPrice ,tests_Prices ) where diff --git a/hledger-web/Hledger/Web/Handler/MiscR.hs b/hledger-web/Hledger/Web/Handler/MiscR.hs index 65a3131f98c..882a91eb337 100644 --- a/hledger-web/Hledger/Web/Handler/MiscR.hs +++ b/hledger-web/Hledger/Web/Handler/MiscR.hs @@ -69,7 +69,7 @@ getPricesR = do VD{caps, j} <- getViewData when (CapView `notElem` caps) (permissionDenied "Missing the 'view' capability") selectRep $ do - provideJson $ jpricedirectives j + provideJson $ map priceDirectiveToMarketPrice $ jpricedirectives j getCommoditiesR :: Handler TypedContent getCommoditiesR = do