From 010f58057e9284aac8e26199bdeb985c864ad077 Mon Sep 17 00:00:00 2001 From: inso <insomniak.fr@gmaiL.com> Date: Fri, 26 Feb 2016 08:14:09 +0000 Subject: [PATCH] Fix bug when amount is 0 --- ucoinpy/documents/transaction.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ucoinpy/documents/transaction.py b/ucoinpy/documents/transaction.py index 799b713b..bc7f251d 100644 --- a/ucoinpy/documents/transaction.py +++ b/ucoinpy/documents/transaction.py @@ -13,6 +13,9 @@ def reduce_base(amount, base): :return: tuple containing computed (amount, base) :rtype: tuple """ + if amount == 0: + return 0, 0 + next_amount = amount next_base = base while int(next_amount) == next_amount: @@ -20,7 +23,7 @@ def reduce_base(amount, base): base = next_base next_amount /= 10 next_base += 1 - return amount, base + return int(amount), int(base) class Transaction(Document): -- GitLab