Skip to content

Commit

Permalink
Added formatting changes, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
oogetyboogety committed Jun 19, 2018
1 parent 8e281a0 commit e60686b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
18 changes: 8 additions & 10 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,15 +1156,11 @@ def get_quarterly_stats(self):
bounty for bounty in bounties if bounty.is_hunter(self.handle) and bounty.status == 'done'
]
fulfilled_bounties_count = len(fulfilled_bounties)
funded_bounties = [
bounty for bounty in bounties if bounty.is_funder(self.handle)
]
funded_bounties_count = len(funded_bounties)
funded_bounties = self.get_funded_bounties()
funded_bounties_count = funded_bounties.count()
from django.db.models import Sum
if funded_bounties_count:
total_funded_usd = sum([
bounty.value_in_usdt if bounty.value_in_usdt else 0
for bounty in funded_bounties
])
total_funded_usd = funded_bounties.all().aggregate(Sum('value_in_usdt'))
total_funded_hourly_rate = float(0)
#TODO: Explain to the user that we only counted Bounties that developers entered # of hours worked on
hourly_rate_bounties_counted = float(0)
Expand Down Expand Up @@ -1196,8 +1192,10 @@ def get_quarterly_stats(self):
user_funded_bounty_developers.append(fulfillment.fulfiller_github_username.lstrip('@'))
user_funded_bounty_developers = [*{*user_funded_bounty_developers}]
if funded_fulfillments_with_hours_counted:
avg_hourly_rate_per_funded_bounty = float(total_funded_hourly_rate) / float(funded_fulfillments_with_hours_counted)
avg_hours_per_funded_bounty = float(total_funded_hours) / float(funded_fulfillments_with_hours_counted)
avg_hourly_rate_per_funded_bounty = \
float(total_funded_hourly_rate) / float(funded_fulfillments_with_hours_counted)
avg_hours_per_funded_bounty = \
float(total_funded_hours) / float(funded_fulfillments_with_hours_counted)
else:
avg_hourly_rate_per_funded_bounty = 0
avg_hours_per_funded_bounty = 0
Expand Down
22 changes: 17 additions & 5 deletions app/retail/templates/emails/quarterly_stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,13 @@ <h4>An overview of your stats from the last 3 months.</h4>
</div>
<div class="stat-contents">
<p>You've boosted your skills in {{ user_no_of_languages }} different areas:
{% for language in user_languages %}{% if forloop.counter == user_no_of_languages %} and {% elif forloop.first %}{% else %},{% endif %} {{ language }}{% endfor %}!
{% for language in user_languages %}
{% if forloop.counter == user_no_of_languages %}
{% if not forloop.first %} and {% endif %}
{% else %},
{% endif %}
{{ language }}
{% endfor %}!
</p>
</div>
</div>
Expand All @@ -245,19 +251,25 @@ <h2>You've Been Making Money Moves</h2>
<h4>An overview of your OSS project's stats from the last 3 months.</h4>
<div class="centered-contents stat-box row">
<div class="stat-img full-bordered-circle percent-content col-sm-12">
<p class="content">{{ user_funded_fulfilled_percentage}} %</p>
<p class="content">{{ user_funded_fulfilled_percentage }} %</p>
</div>
<div class="stat-contents col-sm-12">
<p>Of the {{ user_funded_bounties_count | intcomma }} issue{%if user_funded_bounties_count > 1 %}s{% endif %} that you funded a bounty for, {{ user_num_funded_fulfilled_bounties | intcomma }} were fulfilled -- that's a {{ user_funded_fulfilled_percentage}}% success rate!</p>
<p>Of the {{ user_funded_bounties_count | intcomma }} issue{{ user_funded_bounties_count|pluralize }} that you funded a bounty for, {{ user_num_funded_fulfilled_bounties | intcomma }} were fulfilled -- that's a {{ user_funded_fulfilled_percentage}}% success rate!</p>
</div>
</div>
<div class="centered-contents stat-box row">
<div class="stat-img total-transaction">
<p class="content">{{ user_funded_bounty_developers | length }} contributors</p>
</div>
<div class="stat-contents col-sm-12">
<p>The following {{ user_funded_bounty_developers | length }} developers have made contributions to your OSS projects this quarter:
{% for developer in user_funded_bounty_developers %}{% if forloop.counter == user_num_funded_bounty_developers %} &amp; {% elif forloop.first %}{% else %}, {% endif %}<a href="https://github.com/{{ developer }}">@{{ developer }}</a>{% endfor %}</p>
<p>The following {{ user_funded_bounty_developers | length }} developer{{ user_funded_bounty_developers|pluralize }} have made contributions to your OSS projects this quarter:
{% for developer in user_funded_bounty_developers %}
{% if forloop.counter == user_num_funded_bounty_developers %} &amp;
{% elif forloop.first %}
{% else %},
{% endif %}
<a href="https://github.com/{{ developer }}">@{{ developer }}</a>
{% endfor %}</p>
</div>
</div>
<div class="centered-contents stat-box row">
Expand Down

0 comments on commit e60686b

Please sign in to comment.