Skip to content

Commit

Permalink
Merge pull request #4762 from gitcoinco/kevin/profile_speed_4
Browse files Browse the repository at this point in the history
more profile speed improvments
  • Loading branch information
owocki authored Jul 11, 2019
2 parents 36be08c + 34dc148 commit 6f38d50
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2646,8 +2646,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':
Expand All @@ -2660,9 +2659,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

Expand Down Expand Up @@ -2720,7 +2717,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':
Expand Down

0 comments on commit 6f38d50

Please sign in to comment.