fix: web: register chart with multiple commodities/prices, broken in 1.22 (#1597)
Make sure to strip prices from amounts before generating JSON data for the register chart.
This commit is contained in:
parent
b8f0900edb
commit
3380190d9a
@ -107,7 +107,8 @@ registerChartHtml q title percommoditytxnreports = $(hamletFile "templates/chart
|
|||||||
charttitle = if null title then "" else title ++ ":"
|
charttitle = if null title then "" else title ++ ":"
|
||||||
colorForCommodity = fromMaybe 0 . flip lookup commoditiesIndex
|
colorForCommodity = fromMaybe 0 . flip lookup commoditiesIndex
|
||||||
commoditiesIndex = zip (map fst percommoditytxnreports) [0..] :: [(CommoditySymbol,Int)]
|
commoditiesIndex = zip (map fst percommoditytxnreports) [0..] :: [(CommoditySymbol,Int)]
|
||||||
simpleMixedAmountQuantity = maybe 0 aquantity . listToMaybe . amounts
|
simpleMixedAmountQuantity = maybe 0 aquantity . listToMaybe . amounts . mixedAmountStripPrices
|
||||||
|
showZeroCommodity = wbUnpack . showMixedAmountB oneLine{displayPrice=False,displayZeroCommodity=True}
|
||||||
shownull c = if null c then " " else c
|
shownull c = if null c then " " else c
|
||||||
nodatelink = (RegisterR, [("q", T.unwords $ removeDates q)])
|
nodatelink = (RegisterR, [("q", T.unwords $ removeDates q)])
|
||||||
|
|
||||||
|
|||||||
@ -36,8 +36,8 @@
|
|||||||
[
|
[
|
||||||
#{dayToJsTimestamp $ triDate i},
|
#{dayToJsTimestamp $ triDate i},
|
||||||
#{simpleMixedAmountQuantity $ triCommodityBalance c i},
|
#{simpleMixedAmountQuantity $ triCommodityBalance c i},
|
||||||
'#{showMixedAmountWithZeroCommodity $ triCommodityAmount c i}',
|
'#{showZeroCommodity $ triCommodityAmount c i}',
|
||||||
'#{showMixedAmountWithZeroCommodity $ triCommodityBalance c i}',
|
'#{showZeroCommodity $ triCommodityBalance c i}',
|
||||||
'#{concat $ intersperse "\\n" $ lines $ T.unpack $ showTransaction $ triOrigTransaction i}',
|
'#{concat $ intersperse "\\n" $ lines $ T.unpack $ showTransaction $ triOrigTransaction i}',
|
||||||
#{tindex $ triOrigTransaction i}
|
#{tindex $ triOrigTransaction i}
|
||||||
],
|
],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user