fava_investor icon indicating copy to clipboard operation
fava_investor copied to clipboard

Display of numbers with zero decimal places

Open redstreet opened this issue 4 years ago • 1 comments

We need to be able to display a value of type Decimal in a table, without displaying the decimal point or digits after it. Eg: Decimal(23.92) should display simply as '24' in the table. This helps with several investing reports, since decimal places don't matter, and the display is cleaner without them.

redstreet avatar Mar 26 '20 09:03 redstreet

I tried inserting Decimal(23.92).to_integral(), but that ended up displaying as '24.00' How can I get rid of the '.00'? I'd rather not do int() since I'd prefer to respect the locale settings (like commas) for everything else

Looks like fava/core/number.py calls Precision in beancount.core.display_context, but I'm not seeing an existing way to specify the number of decimals displayed.

redstreet avatar Mar 26 '20 09:03 redstreet