From a262a0df02af0e8e74286b7e75a8e3f47f06bce4 Mon Sep 17 00:00:00 2001 From: eayllon1 Date: Tue, 24 Sep 2019 00:21:02 -0400 Subject: [PATCH 1/2] Fix typings for addition in eth_sum --- app/dashboard/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/dashboard/models.py b/app/dashboard/models.py index cb3cf53a8c8..a2d5fe1c386 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -3254,8 +3254,12 @@ def get_eth_sum(self, sum_type='collected', network='mainnet', bounties=None): logger.exception(e) pass - # if sum_type == 'collected': - # eth_sum = eth_sum + float(sum([amount.value_in_eth for amount in self.tips])) if self.tips else eth_sum + if sum_type == 'collected': + if self.tips: + tip_sum = 0 + for amount in self.tips: + tip_sum = tip_sum + float(amount.value_in_eth) + eth_sum = eth_sum + tip_sum return eth_sum From e4ab8803d8366e5891d8ea94241c85806e90ecb5 Mon Sep 17 00:00:00 2001 From: eayllon1 Date: Sat, 28 Sep 2019 19:18:26 -0400 Subject: [PATCH 2/2] list comprehension --- app/dashboard/models.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 1530bb81381..c36ee5c4128 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -3254,12 +3254,8 @@ def get_eth_sum(self, sum_type='collected', network='mainnet', bounties=None): logger.exception(e) pass - if sum_type == 'collected': - if self.tips: - tip_sum = 0 - for amount in self.tips: - tip_sum = tip_sum + float(amount.value_in_eth) - eth_sum = eth_sum + tip_sum + if sum_type == 'collected' and self.tips: + eth_sum = eth_sum + sum([ float(amount.value_in_eth) for amount in self.tips ]) return eth_sum