Created
April 1, 2019 16:20
-
-
Save owocki/2aa9e09a06c1d4540ae303740063dd24 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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