From 34dc148d94b651d0014f173ac4250529b3072c1f Mon Sep 17 00:00:00 2001 From: Owocki Date: Tue, 9 Jul 2019 13:56:52 -0600 Subject: [PATCH] more profile speed improvments --- app/dashboard/models.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/dashboard/models.py b/app/dashboard/models.py index f7004c53bc2..089f8226c10 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -2641,8 +2641,7 @@ def get_eth_sum(self, sum_type='collected', network='mainnet', bounties=None): """ eth_sum = 0 - - if not bounties: + if bounties is None: if sum_type == 'funded': bounties = self.get_funded_bounties(network=network) elif sum_type == 'collected': @@ -2655,9 +2654,7 @@ def get_eth_sum(self, sum_type='collected', network='mainnet', bounties=None): try: if bounties.exists(): - eth_sum = bounties.aggregate( - Sum('value_in_eth') - )['value_in_eth__sum'] / 10**18 + eth_sum = sum([amount for amount in bounty.values_list("value_in_eth", flat=True)]) except Exception: pass @@ -2715,7 +2712,7 @@ def get_who_works_with(self, work_type='collected', network='mainnet', bounties= dict: list of the profiles that were worked with (key) and the number of times they occured """ - if not bounties: + if bounties is None: if work_type == 'funded': bounties = self.bounties_funded.filter(network=network) elif work_type == 'collected':