From 509f82f0c0d9675c9e649106591b5d15178bc910 Mon Sep 17 00:00:00 2001 From: Owocki Date: Wed, 13 Jun 2018 17:14:59 -0600 Subject: [PATCH 1/2] resolving todos --- app/dashboard/models.py | 4 ---- app/retail/templates/emails/quarterly_stats.html | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/dashboard/models.py b/app/dashboard/models.py index d938fdb53ac..239a4f244d2 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -1166,7 +1166,6 @@ def get_quarterly_stats(self): for bounty in funded_bounties ]) 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 @@ -1175,7 +1174,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): @@ -1202,7 +1200,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) @@ -1266,7 +1263,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] diff --git a/app/retail/templates/emails/quarterly_stats.html b/app/retail/templates/emails/quarterly_stats.html index 14af09d4d57..a35870ed315 100644 --- a/app/retail/templates/emails/quarterly_stats.html +++ b/app/retail/templates/emails/quarterly_stats.html @@ -260,15 +260,17 @@

An overview of your OSS project's stats from the last 3 months.

{% for developer in user_funded_bounty_developers %}{% if forloop.counter == user_num_funded_bounty_developers %} & {% elif forloop.first %}{% else %}, {% endif %}@{{ developer }}{% endfor %}

+ {% if user_total_funded_hours %}

{{ user_total_funded_hours | intcomma }} hours

{{ user_total_funded_usd | intcomma }} USD

-

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..

+

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..

+ {% endif %}
{% trans "Share my stats" %} From 42ddb96b393567a82461d340532c65ab098360d6 Mon Sep 17 00:00:00 2001 From: Owocki Date: Wed, 13 Jun 2018 17:18:18 -0600 Subject: [PATCH 2/2] smal lthing --- app/retail/emails.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/retail/emails.py b/app/retail/emails.py index e2494c392c1..32bdda55fe4 100644 --- a/app/retail/emails.py +++ b/app/retail/emails.py @@ -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)