alan-turing-institute / rctab-cli

RCTab CLI
MIT License
0 stars 0 forks source link

Show financial figures to two decimal places #14

Open Iain-S opened 7 months ago

Iain-S commented 7 months ago

For rctab sub summary, and possibly other commands, we output the raw data as returned by the server. This means that financial figures are shown to many decimal places:

rctab sub summary --subscription-id 1234z-1234a-1234b-1234c
[
    {
        ...
        "total_cost": 78.18015651709896
    }
]

However, it would be nice to either:

a. Show figures to to two decimal places by default, or b. Show some shell trick to accomplish the same thing.

joseph-palmer commented 6 months ago

a. Can be achieved by placing item["total_cost"] = round(item["total_cost"], 2) After item.pop("role_assignments")