From f50258f133c9e4a23d598a7550351e96f064aeec Mon Sep 17 00:00:00 2001 From: Adrien CLERC Date: Wed, 29 Apr 2020 22:30:49 +0200 Subject: [PATCH] remove converted_amount from history when amount is the same converted_amount is changed along with amount, and should stay the same value converted_amount will change with currency, and we will need it there. --- ihatemoney/history.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ihatemoney/history.py b/ihatemoney/history.py index 9dda3de6..faa12c09 100644 --- a/ihatemoney/history.py +++ b/ihatemoney/history.py @@ -105,6 +105,14 @@ def get_history(project, human_readable_names=True): if removed: changeset["owers_removed"] = (None, removed) + # Remove converted_amount if amount changed in the same way. + if ( + "amount" in changeset + and "converted_amount" in changeset + and changeset["amount"] == changeset["converted_amount"] + ): + del changeset["converted_amount"] + for (prop, (val_before, val_after),) in changeset.items(): if human_readable_names: if prop == "payer_id":