Skip to content

Commit

Permalink
Merge branch 'stats-email' of github.com:oogetyboogety/web into stats…
Browse files Browse the repository at this point in the history
…-email
  • Loading branch information
oogetyboogety committed Jun 19, 2018
2 parents e60686b + 42ddb96 commit 491d09d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 0 additions & 4 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,6 @@ def get_quarterly_stats(self):
if funded_bounties_count:
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)
for bounty in funded_bounties:
hourly_rate = bounty.hourly_rate
Expand All @@ -1171,7 +1170,6 @@ def get_quarterly_stats(self):
hourly_rate_bounties_counted += 1
funded_bounty_fulfillments = []
for bounty in funded_bounties:
#TODO: Check that all bounty fulfillments have acceptance and that there are no bounties that have skipped the Acceptance in fulfillment step of workflow
fulfillments = bounty.fulfillments.filter(accepted=True)
for fulfillment in fulfillments:
if isinstance(fulfillment, BountyFulfillment):
Expand Down Expand Up @@ -1200,7 +1198,6 @@ def get_quarterly_stats(self):
avg_hourly_rate_per_funded_bounty = 0
avg_hours_per_funded_bounty = 0
funded_fulfilled_bounties = [
#TODO: Change this to check for terminal statuses instead?
bounty for bounty in funded_bounties if bounty.status == 'done'
]
num_funded_fulfilled_bounties = len(funded_fulfilled_bounties)
Expand Down Expand Up @@ -1264,7 +1261,6 @@ def get_quarterly_stats(self):
current_bounty=True,
metadata__icontains=keyword,
idx_status__in=['open'],
#TODO: Identify the random sampling method used, see if it sending mass emails becomes slow
).order_by('?')
)
relevant_bounties = relevant_bounties[:3]
Expand Down
3 changes: 2 additions & 1 deletion app/retail/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,8 @@ def roundup(request):
def quarterly_roundup(request):
from marketing.utils import get_platform_wide_stats
platform_wide_stats = get_platform_wide_stats()
response_html, _ = render_quarterly_stats(settings.CONTACT_EMAIL, platform_wide_stats)
email = settings.CONTACT_EMAIL
response_html, _ = render_quarterly_stats(email, platform_wide_stats)
return HttpResponse(response_html)


Expand Down
4 changes: 3 additions & 1 deletion app/retail/templates/emails/quarterly_stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,17 @@ <h4>An overview of your OSS project's stats from the last 3 months.</h4>
{% endfor %}</p>
</div>
</div>
{% if user_total_funded_hours %}
<div class="centered-contents stat-box row">
<div class="stat-img">
<p class="content bounty-img">{{ user_total_funded_hours | intcomma }} hours</p>
<p class="content bounty-fund-img">{{ user_total_funded_usd | intcomma }} USD</p>
</div>
<div class="stat-contents">
<p>Developers worked an average of {{ user_avg_hours_per_funded_bounty }} hours per issue on your projects. You funded a total of ${{ user_total_funded_usd | intcomma }} USD of work at an average rate of ${{ user_avg_hourly_rate_per_funded_bounty }} USD / hour..</p>
<p>Developers worked an average of {{ user_avg_hours_per_funded_bounty }} hours per issue on your projects (only applies to bounties where users entered their hours). You funded a total of ${{ user_total_funded_usd | intcomma }} USD of work at an average rate of ${{ user_avg_hourly_rate_per_funded_bounty }} USD / hour..</p>
</div>
</div>
{% endif %}

<div class="button-action">
<a class="button" href="{% url 'dashboard' %}">{% trans "Share my stats" %}</a>
Expand Down

0 comments on commit 491d09d

Please sign in to comment.