Skip to content

Commit

Permalink
more profile speed improvments
Browse files Browse the repository at this point in the history
  • Loading branch information
owocki committed Jul 9, 2019
1 parent 687948a commit 34dc148
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 @@ -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':
Expand All @@ -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

Expand Down Expand Up @@ -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':
Expand Down

0 comments on commit 34dc148

Please sign in to comment.