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

GITC-408: Update contributions email with L2 info #9491

Merged
merged 5 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from 4 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
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,10 +92,22 @@
<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>
<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>
{% 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;">
<div style="display: inline-block; margin-top: 1.5em; margin-bottom: 2em; text-align: center;">
<div class="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