Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix grants explorer #9559

Merged
merged 1 commit into from
Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/grants/management/commands/sent_cart_reminder.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def add_arguments(self, parser):

def handle(self, *args, **options):

_, round_start_date, round_end_date, _ = get_clr_rounds_metadata()
_, round_start_date, round_end_date, _, _, _, _, _ = get_clr_rounds_metadata()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chibie This is a quick fix, but this method is extremely fragile. It feels like it should be returning an object, not a tuple that we can access data on without guessing how many and where the _ should go. I approve this so we can fix the deploy, but let's open a new tech debt ticket in Jira to fix this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ksolo yea makes perfect sense

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a named tuple would likely provide enough of an abstraction to prevent these types of bugs - https://docs.python.org/3/library/collections.html#collections.namedtuple

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ticket is GITC-477


last_activity_by_user = CartActivity.objects.filter(latest=True, created_on__gt=round_start_date).exclude(metadata=[])
count = 0
Expand Down
4 changes: 2 additions & 2 deletions app/grants/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ def grants_by_grant_type(request, grant_type):
if _type.get("keyword") == grant_type:
grant_label = _type.get("label")

_, round_start_date, round_end_date, _ = get_clr_rounds_metadata()
_, round_start_date, round_end_date, _, _, _, _, _ = get_clr_rounds_metadata()

params = {
'active': 'grants_explorer',
Expand Down Expand Up @@ -1208,7 +1208,7 @@ def grants_by_grant_clr(request, clr_round):

active_rounds = GrantCLR.objects.filter(is_active=True, start_date__lt=timezone.now(), end_date__gt=timezone.now()).order_by('-total_pot')

_, round_start_date, round_end_date, _ = get_clr_rounds_metadata()
_, round_start_date, round_end_date, _, _, _, _, _ = get_clr_rounds_metadata()

params = {
'active': 'grants_landing',
Expand Down
2 changes: 1 addition & 1 deletion app/marketing/management/commands/post_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def earners(days, cadence):

def grants():

clr_round, _, _, _ = get_clr_rounds_metadata()
clr_round, _, _, _, _, _, _, _ = get_clr_rounds_metadata()
active_clr_rounds = GrantCLR.objects.filter(is_active=True, customer_name='ethereum', start_date__lt=timezone.now(), end_date__gt=timezone.now())
if not active_clr_rounds.exists():
return
Expand Down
2 changes: 1 addition & 1 deletion app/perftools/management/commands/create_page_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def create_hack_event_cache():

def create_top_grant_spenders_cache():

_, round_start_date, _, _ = get_clr_rounds_metadata()
_, round_start_date, _, _, _, _, _, _ = get_clr_rounds_metadata()

grant_types = GrantType.objects.filter(is_visible=True, is_active=True)
for grant_type in grant_types:
Expand Down
2 changes: 1 addition & 1 deletion app/retail/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ def get_kudos_leaderboard(key='kudos_token.artist'):
context['median_contribution'] = round(Contribution.objects.order_by("subscription__amount_per_period_usdt")[median_index].subscription.amount_per_period_usdt, 2)
context['avg_contribution'] = round(grants_gmv / num_contributions, 2)
from grants.utils import get_clr_rounds_metadata
clr_round, _, _, _ = get_clr_rounds_metadata()
clr_round, _, _, _, _, _, _, _ = get_clr_rounds_metadata()
context['num_matching_rounds'] = clr_round
context['ads_served'] = str(round(ManualStat.objects.filter(key='ads_served').order_by('-pk').first().val / 10**6, 1)) + "m"
context['privacy_violations'] = ManualStat.objects.filter(key='privacy_violations').order_by('-pk').first().val
Expand Down
2 changes: 1 addition & 1 deletion scripts/debug/add_squelched_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# total stats


_, round_start_date, round_end_date, _ = get_clr_rounds_metadata()
_, round_start_date, round_end_date, _, _, _, _, _ = get_clr_rounds_metadata()

contributions = Contribution.objects.filter(created_on__gt=round_start_date, created_on__lt=round_end_date, success=True)
pfs = PhantomFunding.objects.filter(created_on__gt=round_start_date, created_on__lt=round_end_date)
Expand Down
2 changes: 1 addition & 1 deletion scripts/debug/address_usage_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# total stats

_, round_start_date, round_end_date, _ = get_clr_rounds_metadata()
_, round_start_date, round_end_date, _, _, _, _, _ = get_clr_rounds_metadata()

contributions = Contribution.objects.filter(created_on__gt=round_start_date, created_on__lt=round_end_date, success=True)
pfs = PhantomFunding.objects.filter(created_on__gt=round_start_date, created_on__lt=round_end_date)
Expand Down
2 changes: 1 addition & 1 deletion scripts/debug/grants_collusion_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# total stats

_, round_start_date, round_end_date, _ = get_clr_rounds_metadata()
_, round_start_date, round_end_date, _, _, _, _, _ = get_clr_rounds_metadata()


contributions = Contribution.objects.filter(created_on__gt=round_start_date, created_on__lt=round_end_date, success=True)
Expand Down
2 changes: 1 addition & 1 deletion scripts/debug/grants_export.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from grants.models import Grant
from grants.utils import get_clr_rounds_metadata

clr_round, _, _, _ = get_clr_rounds_metadata()
clr_round, _, _, _, _, _, _, _ = get_clr_rounds_metadata()

# total stats

Expand Down