Skip to content

Instantly share code, notes, and snippets.

@owocki
Created April 1, 2019 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save owocki/2aa9e09a06c1d4540ae303740063dd24 to your computer and use it in GitHub Desktop.
Save owocki/2aa9e09a06c1d4540ae303740063dd24 to your computer and use it in GitHub Desktop.
nav_options = [
{'label': 'All', 'keyword': ''},
{'label': 'Security', 'keyword': 'security'},
{'label': 'Scalability', 'keyword': 'scalability'},
{'label': 'UI/UX', 'keyword': 'UI'},
{'label': 'DeFI', 'keyword': 'defi'},
{'label': 'Education', 'keyword': 'education'},
{'label': 'Wallets', 'keyword': 'wallet'},
{'label': 'Community', 'keyword': 'community'},
{'label': 'ETH 2.0', 'keyword': 'ETH 2.0'},
{'label': 'ETH 1.x', 'keyword': 'ETH 1.x'},
]
network = 'mainnet'
from grants.models import Contribution, Grant
for no in nav_options:
label = no['label']
keyword = no['keyword']
grants = Grant.objects.filter(network=network).keyword(keyword)
grants_pks = grants.values_list('pk', flat=True)
conributions = Contribution.objects.filter(subscription__grant__pk__in=grants_pks)
amount = round(sum([conribution.subscription.get_converted_amount() for conribution in conributions if conribution.subscription.get_converted_amount()]))
print(f"{label}: {conributions.count()} worth ${amount} ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment