imp: lib: include adeclarationinfo, if present, in accounts JSON

Note that this does not add the declaration info if it is not already
present.
This commit is contained in:
S. Zeid 2023-10-11 22:37:50 -05:00 committed by Simon Michael
parent 0bfd7f66b0
commit 91d6f8c841

View File

@ -165,20 +165,21 @@ accountKV ::
#endif #endif
=> Account -> [kv] => Account -> [kv]
accountKV a = accountKV a =
[ "aname" .= aname a [ "aname" .= aname a
, "aebalance" .= aebalance a , "adeclarationinfo" .= adeclarationinfo a
, "aibalance" .= aibalance a , "aebalance" .= aebalance a
, "anumpostings" .= anumpostings a , "aibalance" .= aibalance a
, "aboring" .= aboring a , "anumpostings" .= anumpostings a
, "aboring" .= aboring a
-- To avoid a cycle, show just the parent account's name -- To avoid a cycle, show just the parent account's name
-- in a dummy field. When re-parsed, there will be no parent. -- in a dummy field. When re-parsed, there will be no parent.
, "aparent_" .= maybe "" aname (aparent a) , "aparent_" .= maybe "" aname (aparent a)
-- Just the names of subaccounts, as a dummy field, ignored when parsed. -- Just the names of subaccounts, as a dummy field, ignored when parsed.
, "asubs_" .= map aname (asubs a) , "asubs_" .= map aname (asubs a)
-- The actual subaccounts (and their subs..), making a (probably highly redundant) tree -- The actual subaccounts (and their subs..), making a (probably highly redundant) tree
-- ,"asubs" .= asubs a -- ,"asubs" .= asubs a
-- Omit the actual subaccounts -- Omit the actual subaccounts
, "asubs" .= ([]::[Account]) , "asubs" .= ([]::[Account])
] ]
instance ToJSON Ledger instance ToJSON Ledger