Skip to content

Commit

Permalink
migrates results page to consolidate the story (#7719)
Browse files Browse the repository at this point in the history
* migrates results page to consolidate the story

* other
  • Loading branch information
owocki authored Oct 28, 2020
1 parent 974d95c commit 9e36de0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/assets/v2/css/results.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
..box {
width: 20px;
height: 20px;
margin-right: 10px;
margin-right: 5px;
}

.navbar {
Expand Down
9 changes: 3 additions & 6 deletions app/retail/templates/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,9 @@ <h3 class="chart_container__title">{% trans "Broken Down by Month" %}</h3>
<h3 class="chart_container__title" style="margin-right:2rem;">{% trans "and by Type" %}</h3>
<div class="chart_container__content chart_container--flex">
<div class="bounty-status-list">
<p><span class="box box_1"></span> &nbsp;&nbsp;&nbsp;{% trans "Bounties" %}</p>
<p><span class="box box_2"></span> &nbsp;&nbsp;&nbsp;{% trans "Tips" %}</p>
<p><span class="box box_3"></span> &nbsp;&nbsp;&nbsp;{% trans "Grants" %}</p>
<p><span class="box box_4"></span> &nbsp;&nbsp;&nbsp;{% trans "Kudos" %}</p>
<p><span class="box box_5"></span> &nbsp;&nbsp;&nbsp;{% trans "Ads" %}</p>
<p><span class="box box_6"></span> &nbsp;&nbsp;&nbsp;{% trans "Ecosystem" %}</p>
<p><span class="box box_1"></span> &nbsp;&nbsp;&nbsp;{% trans "Hackathons" %}</p>
<p><span class="box box_2"></span> &nbsp;&nbsp;&nbsp;{% trans "Grants" %}</p>
<p><span class="box box_3"></span> &nbsp;&nbsp;&nbsp;{% trans "Other" %}</p>
</div>
</div>
</div>
Expand Down
25 changes: 13 additions & 12 deletions app/retail/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,9 @@ def get_bounty_history_row(label, date, keyword):
print(label, date, core_platform, keyword, bounties, tips, ecosystem)
return [
label,
bounties,
tips,
bounties + tips,
get_grants_history_at_date(date, keyword),
get_kudos_history_at_date(date, keyword),
codefund,
ecosystem,
codefund + ecosystem + get_kudos_history_at_date(date, keyword),
]


Expand Down Expand Up @@ -356,14 +353,14 @@ def get_bounty_median_turnaround_time(func='turnaround_time_started', keyword=No

def get_bounty_history(keyword=None, cumulative=True):
bh = [
['', 'Bounties', 'Tips', 'Grants', 'Kudos', 'Ads', 'Ecosystem'],
['', 'Hackathons', 'Grants', 'Other'],
]
initial_stats = [
["December 2017", 5534, 2011, 0, 0, 0, 0],
["January 2018", 15930, 5093, 0, 0, 0, 0],
["February 2018", 16302, 7391, 0, 0, 0, 0],
["March 2018", 26390, 8302, 0, 0, 0, 0],
["April 2018", 37342, 10109, 0, 0, 0, 0],
["December 2017", 5534 + 2011, 0, 0],
["January 2018", 15930 + 5093, 0, 0],
["February 2018", 16302 + 7391, 0, 0],
["March 2018", 26390 + 8302, 0, 0],
["April 2018", 37342 + 10109, 0, 0],
]
if not keyword:
bh = bh + initial_stats
Expand Down Expand Up @@ -525,20 +522,24 @@ def get_kudos_leaderboard(key='kudos_token.artist'):
# Bounties
from marketing.models import ManualStat
completion_rate = get_completion_rate(keyword)
pp.profile_time('completion_rate')
funder_receiver_stats = get_funder_receiver_stats(keyword)
pp.profile_time('funder_receiver_stats')
context['kudos_leaderboards'] = [
['Top Kudos Artists 👩‍🎨', get_kudos_leaderboard('kudos_token.artist'), 'created'],
['Top Kudos Collectors 🖼', get_kudos_leaderboard('kudos_kudostransfer.username'), 'collected'],
['Top Kudos Senders 💌', get_kudos_leaderboard('kudos_kudostransfer.from_username'), 'sent']
]
pp.profile_time('kudos_leaderboard')
context['funders'] = funder_receiver_stats['funders']
context['avg_value'] = funder_receiver_stats['avg_value']
context['median_value'] = funder_receiver_stats['median_value']
context['transactions'] = funder_receiver_stats['transactions']
context['recipients'] = funder_receiver_stats['recipients']
pp.profile_time('funder_receiver_stats2')
context['mau'] = ManualStat.objects.filter(key='MAUs').order_by('-pk').values_list('val', flat=True)[0]
context['audience'] = json.loads(context['members_history'])[-1][1]
pp.profile_time('completion_rate')
pp.profile_time('audience')
bounty_abandonment_rate = round(100 - completion_rate, 1)
total_bounties_usd = sum(base_bounties.exclude(idx_status__in=['expired', 'cancelled', 'canceled', 'unknown']).values_list('_val_usd_db', flat=True))
total_tips_usd = sum([
Expand Down

0 comments on commit 9e36de0

Please sign in to comment.