From cb77306f5fb0389d4683c8e3175cc6ac750840ec Mon Sep 17 00:00:00 2001 From: Aditya Anand M C Date: Thu, 22 Jul 2021 09:23:37 +0530 Subject: [PATCH] GITC-223: ignore squelched profiles in clr --- app/app/bundle_context.py | 1 + app/dashboard/admin.py | 2 +- app/dashboard/management/commands/bundle.py | 3 +-- app/grants/clr.py | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/app/bundle_context.py b/app/app/bundle_context.py index be87622a344..a79d285bf8f 100644 --- a/app/app/bundle_context.py +++ b/app/app/bundle_context.py @@ -21,6 +21,7 @@ from cacheops import cached_as from perftools.models import JSONStore + @cached_as(JSONStore.objects.filter(view='bundleTags', key='bundleTags'), timeout=60) def templateTags(): diff --git a/app/dashboard/admin.py b/app/dashboard/admin.py index 438e4097eaf..dacd14703be 100644 --- a/app/dashboard/admin.py +++ b/app/dashboard/admin.py @@ -25,6 +25,7 @@ from django.utils.safestring import mark_safe from adminsortable2.admin import SortableInlineAdminMixin +from perftools.management.commands import create_page_cache from .models import ( Activity, Answer, BlockedIP, BlockedURLFilter, BlockedUser, Bounty, BountyEvent, BountyFulfillment, BountyInvites, @@ -35,7 +36,6 @@ TransactionHistory, TribeMember, TribesSubscription, UserAction, UserVerificationModel, ) -from perftools.management.commands import create_page_cache class BountyEventAdmin(admin.ModelAdmin): list_display = ['created_on', '__str__', 'event_type'] diff --git a/app/dashboard/management/commands/bundle.py b/app/dashboard/management/commands/bundle.py index b32d6ba8cab..126d4b4b50d 100644 --- a/app/dashboard/management/commands/bundle.py +++ b/app/dashboard/management/commands/bundle.py @@ -7,9 +7,8 @@ from django.template import Context, Template from django.template.loaders.app_directories import get_app_template_dirs -from dashboard.templatetags.bundle import render - from app.bundle_context import context, templateTags +from dashboard.templatetags.bundle import render def rmdir(loc, depth=1): diff --git a/app/grants/clr.py b/app/grants/clr.py index 5e711cdcc38..f319b493005 100644 --- a/app/grants/clr.py +++ b/app/grants/clr.py @@ -23,6 +23,7 @@ import numpy as np from grants.models import Contribution, Grant, GrantCollection +from townsquare.models import SquelchProfile CLR_PERCENTAGE_DISTRIBUTED = 0 @@ -289,6 +290,10 @@ def fetch_data(clr_round, network='mainnet'): if subscription_filters: contributions = contributions.filter(**subscription_filters) + # ignore profiles which have been squelched + profiles_to_be_ignored = SquelchProfile.objects.filter(active=True).values_list('profile__pk') + contributions = contributions.exclude(profile_for_clr__in=profiles_to_be_ignored) + grants = clr_round.grants.filter(network=network, hidden=False, active=True, is_clr_eligible=True, link_to_new_grant=None) if grant_filters: