From 0552f7e812214a26bcd7fddbce670fe631f99826 Mon Sep 17 00:00:00 2001 From: Vadim Chigrinov Date: Sun, 27 Dec 2020 02:36:25 +0300 Subject: [PATCH] Added payment currency check --- go.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/go.py b/go.py index 739537f..c78b89a 100644 --- a/go.py +++ b/go.py @@ -46,7 +46,10 @@ def get_sum_pay_in() -> int: sum_pay_in = Decimal('0') for operation in operations: if operation.operation_type.value == "PayIn": - sum_pay_in += Decimal(str(operation.payment)) + payment = Decimal(str(operation.payment)) + if operation.currency.name == "usd": + payment *= usd_course + sum_pay_in += payment return int(sum_pay_in)