Skip to content

Commit

Permalink
stable -> master (#7605)
Browse files Browse the repository at this point in the history
* switched source for num contributors and amount contributed (#7599)

* add new fields to profile (#7601)

* fix invoice

Co-authored-by: fronk <[email protected]>
Co-authored-by: Octavio Amuchástegui <[email protected]>
  • Loading branch information
3 people authored Oct 4, 2020
1 parent 6e06ae3 commit b5f73b8
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 41 deletions.
61 changes: 39 additions & 22 deletions app/dashboard/templates/bounty/invoice.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,29 +181,46 @@
</td>
</tr>

{% for fullfillment in accepted_fulfillments %}
<tr class="item">
<td>
{% trans "Direct Payment to " %}{{fullfillment.fulfiller_github_username}} {{fullfillment.fulfiller_address}}
</td>

<td>
{{bounty.value_true}} {{bounty.token_name}} (${{bounty.get_value_in_usdt|floatformat:2}})
</td>
</tr>
{% endfor %}

{% for tip in tips %}
<tr class="item">
<td>
Direct Payment to {{tip.username}} {{tip.receive_address}}
</td>

<td>
{{tip.amount_in_whole_units}} {{tip.tokenName}} (${{tip.value_in_usdt|floatformat:2}})
</td>
</tr>
{% endfor %}
{% if web3_type == 'bounties_network' %}
<!-- LEGACY FLOW -->
{% for fullfillment in accepted_fulfillments %}
<tr class="item">
<td>
{% trans "Direct Payment to " %}{{fullfillment.fulfiller_github_username}} {{fullfillment.fulfiller_address}}
</td>

<td>
{{bounty.value_true}} {{bounty.token_name}} (${{bounty.get_value_in_usdt|floatformat:2}})
</td>
</tr>
{% endfor %}

{% for tip in tips %}
<tr class="item">
<td>
Direct Payment to {{tip.username}} {{tip.receive_address}}
</td>

<td>
{{tip.amount_in_whole_units}} {{tip.tokenName}} (${{tip.value_in_usdt|floatformat:2}})
</td>
</tr>
{% endfor %}

{% else %}
{% for fullfillment in accepted_fulfillments %}
<tr class="item">
<td>
{% trans "Direct Payment to " %}{{fullfillment.fulfiller_github_username}} {{fullfillment.fulfiller_address}}
</td>

<td>
{{fullfillment.payout_amount}} {{fullfillment.token_name}} (${{fullfillment.payout_amount_usd|floatformat:2}})
</td>
</tr>
{% endfor %}
{% endif %}

{% if fee_value_in_usdt %}
<tr class="item">
Expand Down
23 changes: 20 additions & 3 deletions app/dashboard/templates/profiles/header_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,27 @@ <h1 class="profile-header__handle">
</button>
{% endif %}
</p>
{% if profile.data.bio %}
{% if profile.bio %}
<div class="profile-header__bio my-2">
<small class="review-comment">{{ profile.bio }}</small>
</div>
{% elif profile.data.bio %}
<div class="profile-header__bio my-2">
<small class="review-comment">{{ profile.data.bio }}</small>
</div>
{% endif %}
{% if profile.interests %}
Interests:
<div class="tag-list mt-1">
{% for interest in profile.interests %}
{% if forloop.counter < 5 %}
<small class="tag-list__item">{{interest}}</small>
{% endif %}
{% endfor %}
{% if profile.interests|length > 4 %}
<small class="tag-list__item" data-container="body" data-toggle="popover" data-template='<div class="popover big-popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>' data-html="true" data-placement="bottom" data-trigger="hover click" data-content='<div class="tag-list mt-1">{% for interest in profile.interests %} <small class="tag-list__item">{{interest}}</small>{% endfor %}</div>'>+{{profile.interests|length|add:"-4"}}</small>
{% endif %}
</div>
{% endif %}
{% if profile.custom_tagline %}
<div class="profile-header__bio my-2">
Expand Down Expand Up @@ -58,11 +75,11 @@ <h1 class="profile-header__handle">
<i class="fab fa-ethereum"></i>
</a>

<a class="btn btn-outline-gc-blue btn-sm flex-grow-1 font-smaller-5 position-relative quick-link"
<a class="btn btn-outline-gc-blue btn-sm flex-grow-1 font-smaller-5 position-relative quick-link"
href="{% url 'kudos_send' %}?username={{ profile.handle }}" data-placement="bottom" data-toggle="tooltip" data-html="true" title="Kudos @{{ profile.handle }}">
<i class="fas fa-dice-d6"></i>
</a>

<a class="btn btn-outline-gc-blue btn-sm flex-grow-1 font-smaller-5 position-relative quick-link" href="/users?invite={{ profile.handle }}"
data-placement="bottom" data-toggle="tooltip" data-html="true" title="Invite @{{ profile.handle }} to Bounty"
>
Expand Down
28 changes: 21 additions & 7 deletions app/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1427,18 +1427,32 @@ def invoice(request):
active='invoice_view',
title=_('Invoice'),
)

params['accepted_fulfillments'] = bounty.fulfillments.filter(accepted=True)
params['tips'] = [
tip for tip in bounty.tips.send_happy_path() if ((tip.username == request.user.username and tip.username) or (tip.from_username == request.user.username and tip.from_username) or request.user.is_staff)
]
params['total'] = bounty._val_usd_db if params['accepted_fulfillments'] else 0
for tip in params['tips']:
if tip.value_in_usdt:
params['total'] += Decimal(tip.value_in_usdt)
params['web3_type'] = bounty.web3_type

if bounty.web3_type == 'bounties_network':
# Legacy Flow
params['total'] = bounty._val_usd_db if params['accepted_fulfillments'] else 0
params['tips'] = [
tip for tip in bounty.tips.send_happy_path() if ((tip.username == request.user.username and tip.username) or (tip.from_username == request.user.username and tip.from_username) or request.user.is_staff)
]

for tip in params['tips']:
if tip.value_in_usdt:
params['total'] += Decimal(tip.value_in_usdt)
else:
params['total'] = 0
if params['accepted_fulfillments']:
for fulfillment in params['accepted_fulfillments']:
if fulfillment.payout_amount:
fulfillment.payout_amount_usd = convert_amount(fulfillment.payout_amount, fulfillment.token_name, 'USDT')
params['total'] += fulfillment.payout_amount_usd

if bounty.fee_amount > 0:
params['fee_value_in_usdt'] = bounty.fee_amount * Decimal(bounty.get_value_in_usdt) / bounty.value_true
params['total'] = params['total'] + params['fee_value_in_usdt']

return TemplateResponse(request, 'bounty/invoice.html', params)


Expand Down
3 changes: 2 additions & 1 deletion app/grants/management/commands/analytics_clr.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def analytics_clr(from_date=None, clr_round=None, network='mainnet'):
v_threshold,
uv_threshold
)
debug_output.append([grant.id, grant.title, num_contribs, contrib_amount, clr_amount])
# debug_output.append([grant.id, grant.title, num_contribs, contrib_amount, clr_amount])
debug_output.append([grant.id, grant.title, grant.positive_round_contributor_count, float(grant.amount_received_in_round), clr_amount])

return debug_output

Expand Down
1 change: 0 additions & 1 deletion app/grants/management/commands/pending_contributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ def handle(self, *args, **options):
validator_comment__contains="User may not be aware so send them email reminders")
for contribution in contributions:
pending_contribution(contribution)

13 changes: 6 additions & 7 deletions app/marketing/mails.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@
render_grant_txn_failed, render_grant_update, render_kudos_email, render_match_distribution, render_match_email,
render_mention, render_new_bounty, render_new_bounty_acceptance, render_new_bounty_rejection,
render_new_bounty_roundup, render_new_grant_email, render_new_supporter_email, render_new_work_submission,
render_no_applicant_reminder, render_nth_day_email_campaign, render_quarterly_stats, render_remember_your_cart,
render_request_amount_email, render_reserved_issue, render_share_bounty,
render_start_work_applicant_about_to_expire, render_start_work_applicant_expired, render_start_work_approved,
render_start_work_new_applicant, render_start_work_rejected, render_subscription_terminated_email,
render_successful_contribution_email, render_support_cancellation_email, render_tax_report,
render_thank_you_for_supporting_email, render_tip_email, render_tribe_hackathon_prizes,
render_no_applicant_reminder, render_nth_day_email_campaign, render_pending_contribution_email,
render_quarterly_stats, render_remember_your_cart, render_request_amount_email, render_reserved_issue,
render_share_bounty, render_start_work_applicant_about_to_expire, render_start_work_applicant_expired,
render_start_work_approved, render_start_work_new_applicant, render_start_work_rejected,
render_subscription_terminated_email, render_successful_contribution_email, render_support_cancellation_email,
render_tax_report, render_thank_you_for_supporting_email, render_tip_email, render_tribe_hackathon_prizes,
render_unread_notification_email_weekly_roundup, render_wallpost, render_weekly_recap,
render_pending_contribution_email,
)
from sendgrid.helpers.mail import Attachment, Content, Email, Mail, Personalization
from sendgrid.helpers.stats import Category
Expand Down

0 comments on commit b5f73b8

Please sign in to comment.