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 @@

CLR MATCH ROUND 6

-
+

{{grant.amount_received_in_round|floatformat:2}} DAI

- raised from {{grant.positive_round_contributor_count}} contributors + raised from {{grant.positive_round_contributor_count}} contributors

-

- {{ grant.clr_prediction_curve.0.1|floatformat:0|intcomma|default:0 }} DAI -

-

- {% if grant.id in round_5_5_grants %} - Current Round 5.5 Match + {% if grant.is_clr_eligible %} +

+ {{ grant.clr_prediction_curve.0.1|floatformat:0|intcomma|default:0 }} DAI +

+

+ {% if grant.id in round_5_5_grants %} + Current Round 5.5 Match + {% else %} + Estimated CLR Match + {% endif %} +

{% else %} - Estimated CLR Match +

+ {{ grant.monthly_amount_subscribed|floatformat:0|intcomma }} DAI +

+

MONTHLY RECURRING

{% endif %} -

-
- {% include 'grants/card/clr_estimate.html' with short=True %} -
+ + {% if grant.is_clr_eligible %} +
+ {% include 'grants/card/clr_estimate.html' with short=True %} +
+ {% else %} +

+ NOT ELIGIBLE FOR CLR +

+ {% endif%} +
{% is_team_member grant profile as is_on_team %} {% if not is_on_team %} diff --git a/app/grants/templates/grants/cart-vue.html b/app/grants/templates/grants/cart-vue.html index 84014c5908f..02f8f19c6b8 100644 --- a/app/grants/templates/grants/cart-vue.html +++ b/app/grants/templates/grants/cart-vue.html @@ -208,11 +208,14 @@

-
- [[grant.grant_donation_clr_match]] DAI -
- Diamonds high-fiving +
[[grant.grant_donation_clr_match]] DAI
+ Diamonds high-fiving + +
+ Not Eligible for CLR +

{% comment %} Delete Icon {% endcomment %} diff --git a/app/grants/templates/grants/detail/funding.html b/app/grants/templates/grants/detail/funding.html index f27b4bcf741..8eb281d76de 100644 --- a/app/grants/templates/grants/detail/funding.html +++ b/app/grants/templates/grants/detail/funding.html @@ -22,7 +22,7 @@
- {% if clr_active or show_clr_card %} + {% if grant.is_clr_eligible and clr_active %} {% include 'grants/card/clr_match.html' %} {% else %}

MONTHLY RECURRING

@@ -35,7 +35,7 @@

ROUND {{ clr_round }} -

+

{{grant.amount_received_in_round|floatformat:0|intcomma}} DAI @@ -44,32 +44,20 @@ {{grant.positive_round_contributor_count}} contributors

-
- {% if grant_is_inactive %} - - - {% else %} - -
-
- {% endif %} - - {% if clr_active or show_clr_card %} - {% include 'grants/card/clr_estimate.html' %} + {% if grant.is_clr_eligible and clr_active and not grant_is_inactive %} + {% include 'grants/card/clr_estimate.html' %} {% endif %} {% if grant_is_inactive %} - {% elif is_team_member %} - @@ -77,13 +65,13 @@ {% if user_non_errored_subscription %} - {% elif grant.link_to_new_grant %} - @@ -101,8 +89,10 @@ {% if not is_team_member %}
- {% endif %} diff --git a/app/grants/templates/grants/shared/hidden_inputs.html b/app/grants/templates/grants/shared/hidden_inputs.html index e621a18b30c..ba1226a5539 100644 --- a/app/grants/templates/grants/shared/hidden_inputs.html +++ b/app/grants/templates/grants/shared/hidden_inputs.html @@ -13,3 +13,4 @@ + diff --git a/app/grants/views.py b/app/grants/views.py index bafe67bdcf1..07c50c0c8bc 100644 --- a/app/grants/views.py +++ b/app/grants/views.py @@ -78,7 +78,6 @@ total_clr_pot = 175000 clr_round = 6 clr_active = True -show_clr_card = True # Round Schedule # from canonical source of truth https://gitcoin.co/blog/gitcoin-grants-round-4/ # Round 5 - March 23th — April 7th 2020 @@ -449,7 +448,6 @@ def grants_by_grant_type(request, grant_type): 'grant_amount': grant_amount, 'total_clr_pot': total_clr_pot, 'clr_active': clr_active, - 'show_clr_card': show_clr_card, 'sort_by_index': sort_by_index, 'clr_round': clr_round, 'show_past_clr': show_past_clr, @@ -612,7 +610,6 @@ def grant_details(request, grant_id, grant_slug): 'activity_count': activity_count, 'contributors': contributors, 'clr_active': clr_active, - 'show_clr_card': show_clr_card, 'is_team_member': is_team_member, 'voucher_fundings': voucher_fundings, 'is_unsubscribed_from_updates_from_this_grant': is_unsubscribed_from_updates_from_this_grant,