Skip to content

Commit

Permalink
GITC-408: Update contributions email with L2 info (#9491)
Browse files Browse the repository at this point in the history
* include l2 info in contribution email

* display L2 conditionally

* update txt version

* staff polygon

* adjust spacing
  • Loading branch information
chibie committed Sep 21, 2021
1 parent 202d011 commit 4bcd765
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 10 deletions.
16 changes: 16 additions & 0 deletions app/retail/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,26 @@ def render_new_contributions_email(grant):
amount_raised = sum(contributions.values_list('normalized_data__amount_per_period_usdt', flat=True))
num_of_contributors = len(set(contributions.values_list('profile_for_clr', flat=True)))

# amount raised in L2/sidechains
amount_raised_zksync = sum(
contributions.filter(checkout_type='eth_zksync').values_list(
'normalized_data__amount_per_period_usdt', flat=True
)
)
amount_raised_polygon = sum(
contributions.filter(checkout_type='eth_polygon').values_list(
'normalized_data__amount_per_period_usdt', flat=True
)
)

params = {
'grant': grant,
'hours_ago': hours_ago,
'amount_raised': amount_raised,
'amount_raised_zksync': amount_raised_zksync,
'amount_raised_polygon': amount_raised_polygon,
'show_zksync_amount': False if amount_raised_zksync < 1 else True,
'show_polygon_amount': False if amount_raised_polygon < 1 else True,
'num_of_contributors': num_of_contributors,
'media_url': settings.MEDIA_URL,
'utm_tracking': build_utm_tracking('new_contributions'),
Expand Down
32 changes: 23 additions & 9 deletions app/retail/templates/emails/grants/new_contributions.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,23 @@
<img class="center-img bounties-img" src="{% static 'v2/images/emails/grants.png' %}">
<hr>
<h1 style="text-transform: none; font-weight: normal; font-size: 36px;">New Contributions to Your Grant</h1>
<p style="font-size: 14px;">In the past <span style="font-weight: bold;">{{ hours_ago }} hours</span>, your grant has earned approximately:</p>
<p style="font-weight: bold; font-size: 24px; color: #11BC92;">${{ amount_raised|floatformat:2|intcomma }}
<span style="font-weight: normal; font-size: 18px; color: #15003E;">from {{ num_of_contributors }} contributor{{ num_of_contributors|pluralize }}</span>
<p style="font-size: 14px;">In the past <strong>{{ hours_ago }} hours</strong>, your grant has earned approximately:</p>
<br>
<p style="font-weight: bold; font-size: 24px; color: #11BC92; line-height: 1px;">${{ amount_raised|floatformat:2|intcomma }}
<span style="font-weight: normal; font-size: 16px; color: #15003E;">from {{ num_of_contributors }} contributor{{ num_of_contributors|pluralize }}</span>
</p>
<hr style="margin-left: 0;">
{% if show_zksync_amount or show_polygon_amount %}
<p style="font-size: 14px; line-height: 1px;">
including {% if show_zksync_amount %}
<strong>${{ amount_raised_zksync|floatformat:2|intcomma }}</strong> in zkSync{% endif %}
{% if show_polygon_amount and is_staff %}{% if show_zksync_amount %} + {% endif %}
<strong>${{ amount_raised_polygon|floatformat:2|intcomma }}</strong> in Polygon{% endif %}.
</p>
<a href="https://support.gitcoin.co/kb/article/75-how-can-i-withdraw-my-funds-from-zksync/" target="_blank" style="font-size: 12px;">
Read more about zkSync and Polygon
</a>
{% endif %}
<hr style="margin-left: 0; margin-top: 40px;">
<div style="display: inline-block; margin-top: 1.5em; margin-bottom: 2em; text-align: center;">
<div class="grant-logo">
<img class="avatar-bounty" style="max-width: 115px; height: auto;" src="{{ media_url }}{{ grant.logo }}">
Expand All @@ -108,11 +120,13 @@ <h1 style="text-transform: none; font-weight: normal; font-size: 36px;">New Cont
</div>
</div>
<hr style="margin-left: 0; margin-bottom: 2.5em;">
<p style="font-size: 14px;">{% trans "For more information, go to your grants page." %}</p>
<p>
<a href="{{grant.url}}?{{ utm_tracking }}" class="button" style="display: inline-block;">View
Grants Page</a>
</p>
<div style="text-align: center;">
<p style="font-size: 14px;">{% trans "For more information, go to your grants page." %}</p>
<p>
<a href="{{grant.url}}?{{ utm_tracking }}" class="button" style="display: inline-block;">View
Grants Page</a>
</p>
</div>
</div>

{% endblock %}
11 changes: 10 additions & 1 deletion app/retail/templates/emails/grants/new_contributions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@

{% trans "New Contributions to Your Grant" %}

{{ hours_ago }} hours</span>, your grant has earned approximately:
{{ hours_ago }} hours, your grant has earned approximately:

${{ amount_raised|floatformat:2|intcomma }}

from {{ num_of_contributors }} contributor{{ num_of_contributors|pluralize }}

{% if show_zksync_amount or show_polygon_amount %}
including {% if show_zksync_amount %}
${{ amount_raised_zksync|floatformat:2|intcomma }} in zkSync{% endif %}
{% if show_polygon_amount and is_staff %}{% if show_zksync_amount %} + {% endif %}
${{ amount_raised_polygon|floatformat:2|intcomma }} in Polygon{% endif %}.

{% trans "Read more about zkSync and Polygon" %} https://support.gitcoin.co/kb/article/75-how-can-i-withdraw-my-funds-from-zksync/
{% endif %}

{{ grant.title }}

{% trans "For more information, go to your grants page." %}
Expand Down

0 comments on commit 4bcd765

Please sign in to comment.