diff --git a/app/assets/v2/js/cart.js b/app/assets/v2/js/cart.js index cb1287e2b5e..2844a1a215d 100644 --- a/app/assets/v2/js/cart.js +++ b/app/assets/v2/js/cart.js @@ -830,13 +830,16 @@ Vue.component('grants-cart', { for (let i = 0; i < this.grantData.length; i += 1) { const verification_required_to_get_match = false; - if (!document.verified && verification_required_to_get_match) { + if ( + (!document.verified && verification_required_to_get_match) || + grantData.is_clr_eligible == 'False' + ) { this.grantData[i].grant_donation_clr_match = 0; } else { const grant = this.grantData[i]; const matchAmount = await this.predictCLRMatch(grant); - this.grantData[i].grant_donation_clr_match = matchAmount.toFixed(2); + this.grantData[i].grant_donation_clr_match = matchAmount ? matchAmount.toFixed(2) : 0; } } }, diff --git a/app/grants/admin.py b/app/grants/admin.py index c2fa369944e..d4ccd0cda88 100644 --- a/app/grants/admin.py +++ b/app/grants/admin.py @@ -90,11 +90,11 @@ class GrantAdmin(GeneralAdmin): 'logo_asset', 'created_on', 'modified_on', 'team_member_list', 'subscriptions_links', 'contributions_links', 'logo', 'logo_svg', 'image_css', 'link', 'clr_matching', 'clr_prediction_curve', 'hidden', 'grant_type', 'next_clr_calc_date', 'last_clr_calc_date', - 'metadata', 'categories', 'twitter_handle_1', 'twitter_handle_2', 'view_count' + 'metadata', 'categories', 'twitter_handle_1', 'twitter_handle_2', 'view_count', 'is_clr_eligible' ] readonly_fields = [ 'logo_svg_asset', 'logo_asset', - 'team_member_list', + 'team_member_list', 'clr_prediction_curve', 'subscriptions_links', 'contributions_links', 'link', 'migrated_to', 'view_count' ] diff --git a/app/grants/clr.py b/app/grants/clr.py index 945d5b55caa..ce1e735cd5c 100644 --- a/app/grants/clr.py +++ b/app/grants/clr.py @@ -316,23 +316,23 @@ def fetch_data(clr_type=None, network='mainnet', clr_start_date=None, clr_end_da contributions = Contribution.objects.prefetch_related('subscription').filter(match=True, created_on__gte=clr_start_date, created_on__lte=clr_end_date, success=True) if clr_type == 'tech': - grants = Grant.objects.filter(network=network, hidden=False, active=True, grant_type='tech', link_to_new_grant=None) + grants = Grant.objects.filter(network=network, hidden=False, active=True, grant_type='tech', is_clr_eligible=True, link_to_new_grant=None) threshold = THRESHOLD_TECH total_pot = TOTAL_POT_TECH elif clr_type == 'media': - grants = Grant.objects.filter(network=network, hidden=False, active=True, grant_type='media', link_to_new_grant=None) + grants = Grant.objects.filter(network=network, hidden=False, active=True, grant_type='media', is_clr_eligible=True, link_to_new_grant=None) threshold = THRESHOLD_MEDIA total_pot = TOTAL_POT_MEDIA elif clr_type == 'health': - grants = Grant.objects.filter(network=network, hidden=False, active=True, grant_type='health', link_to_new_grant=None) + grants = Grant.objects.filter(network=network, hidden=False, active=True, grant_type='health', is_clr_eligible=True, link_to_new_grant=None) threshold = THRESHOLD_HEALTH total_pot = TOTAL_POT_HEALTH elif clr_type == 'change': - grants = Grant.objects.filter(network=network, hidden=False, active=True, grant_type='change', link_to_new_grant=None) + grants = Grant.objects.filter(network=network, hidden=False, active=True, grant_type='change', is_clr_eligible=True, link_to_new_grant=None) threshold = THRESHOLD_CHANGE total_pot = TOTAL_POT_CHANGE elif clr_type == 'matic': - grants = Grant.objects.filter(network=network, hidden=False, active=True, grant_type='matic', link_to_new_grant=None) + grants = Grant.objects.filter(network=network, hidden=False, active=True, grant_type='matic', is_clr_eligible=True, link_to_new_grant=None) threshold = THRESHOLD_MATIC total_pot = TOTAL_POT_MATIC else: diff --git a/app/grants/migrations/0062_grant_is_clr_eligible.py b/app/grants/migrations/0062_grant_is_clr_eligible.py new file mode 100644 index 00000000000..e68dbb88639 --- /dev/null +++ b/app/grants/migrations/0062_grant_is_clr_eligible.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.4 on 2020-06-18 14:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('grants', '0061_auto_20200617_1748'), + ] + + operations = [ + migrations.AddField( + model_name='grant', + name='is_clr_eligible', + field=models.BooleanField(default=True, help_text='Is grant eligible for CLR'), + ), + ] diff --git a/app/grants/models.py b/app/grants/models.py index 71044a20fb5..eb2c33cc0ba 100644 --- a/app/grants/models.py +++ b/app/grants/models.py @@ -148,6 +148,7 @@ class Meta: description = models.TextField(default='', blank=True, help_text=_('The description of the Grant.')) description_rich = models.TextField(default='', blank=True, help_text=_('HTML rich description.')) reference_url = models.URLField(blank=True, help_text=_('The associated reference URL of the Grant.')) + is_clr_eligible = models.BooleanField(default=True, help_text="Is grant eligible for CLR") link_to_new_grant = models.ForeignKey( 'grants.Grant', null=True, diff --git a/app/grants/tasks.py b/app/grants/tasks.py index 5b6a8206fb4..ac5d6a20853 100644 --- a/app/grants/tasks.py +++ b/app/grants/tasks.py @@ -135,4 +135,3 @@ def process_grant_contribution(self, grant_id, grant_slug, profile_id, package, thank_you_for_supporting(grant, subscription) update_grant_metadata.delay(grant_id) - diff --git a/app/grants/templates/grants/card/front.html b/app/grants/templates/grants/card/front.html index a9abb2ac552..c55c9d4477a 100644 --- a/app/grants/templates/grants/card/front.html +++ b/app/grants/templates/grants/card/front.html @@ -57,30 +57,45 @@
{{grant.amount_received_in_round|floatformat:0|intcomma}} DAI @@ -44,32 +44,20 @@ {{grant.positive_round_contributor_count}} contributors