Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

results page by different keyword #1586

Merged
merged 10 commits into from
Jul 4, 2018
Merged

Conversation

owocki
Copy link
Contributor

@owocki owocki commented Jun 29, 2018

Description

This PR builds on top of #1486 to start laying the groundwork for querying our results by different keywords (.e.g. results/javascript or results/python

Still TODO

  • Joe Dominance Index
  • Bounty Amounts by Status by Keyword
  • Top Repos are not indexed correctly by programming language
  • Mesh Network of Jobs
  • Figure out how to get Alumni / Top Repos to show up ( we may have to add 'keywords' to the Profile object )
  • Hourly Rate of Bounties
  • Community Growth by keyword

@ghost ghost assigned owocki Jun 29, 2018
@ghost ghost added the in progress label Jun 29, 2018
]
for i in [6, 5, 4, 3, 2, 1]:
try:
history = history + [[f'{i} months ago', base_stats.filter(created_on__lt=(timezone.now() - timezone.timedelta(days=i*30))).first().val],]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (150 > 120 characters)
E231 missing whitespace after ','

from dashboard.models import Bounty
base_bounties = Bounty.objects.current().filter(network='mainnet')
base_bounties = Bounty.objects.current().filter(network='mainnet').filter(idx_status__in=['done', 'expired', 'cancelled'])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (126 > 120 characters)



def get_bounty_median_turnaround_time(func='turnaround_time_started', keyword=None):
from dashboard.models import Bounty

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F401 'dashboard.models.Bounty' imported but unused

def build_stat_results(keyword=None):
timeout = 60 * 60 * 24
key = f'build_stat_results_{keyword}'
#results = cache.get(key)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E265 block comment should start with '# '

timeout = 60 * 60 * 24
key = f'build_stat_results_{keyword}'
#results = cache.get(key)
#if results:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E265 block comment should start with '# '

).order_by('-pk')
context['members_history'], context['slack_ticks'] = get_history(base_stats, "Members")

pp.profile_time('Stats1')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W293 blank line contains whitespace

#jdi history
base_stats = Stat.objects.filter(
key='joe_dominance_index_30_value',
key='joe_dominance_index_30_value', #TODO - JDI by keywords

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E261 at least two spaces before inline comment
E262 inline comment should start with '# '

for year in range(2018, 2025):
months = range(1, 12)
if year == 2018:
months = range(6, 12)
for month in months:
then = timezone.datetime(year, month, 3).replace(tzinfo=pytz.UTC)
if then < timezone.now():
row = get_bounty_history_row(then.strftime("%B %Y"), then)
row = get_bounty_history_row(then.strftime("%B %Y"), then, keyword)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W291 trailing whitespace

context['max_bounty_history'] = float(context['universe_total_usd']) * .7
context['bounty_abandonment_rate'] = f'{bounty_abandonment_rate}%'
context['bounty_average_turnaround'] = str(round(get_bounty_median_turnaround_time('turnaround_time_submitted')/24, 1)) + " days"
context['hourly_rate_distribution'] = '$15 - $120'
context['bounty_average_turnaround'] = str(round(get_bounty_median_turnaround_time('turnaround_time_submitted', keyword)/24, 1)) + " days"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (142 > 120 characters)

context['bounty_claimed_completion_rate'] = f'{completion_rate}%'
context['bounty_median_pickup_time'] = round(get_bounty_median_turnaround_time('turnaround_time_started'), 1)
context['bounty_median_pickup_time'] = round(get_bounty_median_turnaround_time('turnaround_time_started', keyword), 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (122 > 120 characters)

@codecov
Copy link

codecov bot commented Jun 30, 2018

Codecov Report

Merging #1586 into master will decrease coverage by 0.28%.
The diff coverage is 11.24%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1586      +/-   ##
==========================================
- Coverage   29.92%   29.63%   -0.29%     
==========================================
  Files         130      131       +1     
  Lines        9658     9782     +124     
  Branches     1247     1269      +22     
==========================================
+ Hits         2890     2899       +9     
- Misses       6662     6777     +115     
  Partials      106      106
Impacted Files Coverage Δ
app/app/urls.py 89.74% <ø> (ø) ⬆️
app/marketing/management/commands/pull_stats.py 0% <0%> (ø) ⬆️
app/retail/management/commands/warm_cache.py 0% <0%> (ø)
app/dataviz/d3_views.py 9.53% <0%> (-0.22%) ⬇️
app/marketing/admin.py 81.53% <100%> (ø) ⬆️
app/retail/utils.py 15.42% <13.41%> (-4.58%) ⬇️
app/retail/views.py 37.25% <50%> (ø) ⬆️
app/app/sitemaps.py 68.62% <54.54%> (-3.88%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae757e2...941812c. Read the comment docs.

for i in [6, 5, 4, 3, 2, 1]:
try:
plural = 's' if i != 1 else ''
history = history + [[f'{i} month{plural} ago', base_stats.filter(created_on__lt=(timezone.now() - timezone.timedelta(days=i*30))).first().val],]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (157 > 120 characters)
E231 missing whitespace after ','

@owocki owocki changed the title WIP - results page by different keyword results page by different keyword Jun 30, 2018
]

for stat in stats_to_create:
#print(stat)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E265 block comment should start with '# '

)

for keyword in keywords:
all_bounties = Bounty.objects.filter(current_bounty=True, network='mainnet', web3_created__gt=(timezone.now() - timezone.timedelta(days=days)))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (155 > 120 characters)

continue

val = int(100 * (joe_bounties.count()) / (all_bounties.count()))
val_val = int(100 * sum([(b.value_in_usdt_now if b.value_in_usdt_now else 0) for b in joe_bounties]) / sum([(b.value_in_usdt_now if b.value_in_usdt_now else 0) for b in all_bounties]))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (196 > 120 characters)

]

for stat in stats_to_create:
#print(stat)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E265 block comment should start with '# '

val=val,
)
for stat in stats_to_create:
#print(stat)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E265 block comment should start with '# '

from django.conf import settings
from django.core.management.base import BaseCommand
from retail.utils import programming_languages
from django.conf import settings

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F811 redefinition of unused 'settings' from line 18

import logging
import warnings

warnings.filterwarnings("ignore", category=DeprecationWarning)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W291 trailing whitespace

print(f"starting at {timezone.now()}")
for path in paths:
self.warm_path(path)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W391 blank line at end of file

context['bounty_claimed_completion_rate'] = f'{completion_rate}%'
context['bounty_median_pickup_time'] = round(get_bounty_median_turnaround_time('turnaround_time_started'), 1)

context['bounty_median_pickup_time'] = round(get_bounty_median_turnaround_time('turnaround_time_started', keyword), 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (122 > 120 characters)

@owocki
Copy link
Contributor Author

owocki commented Jun 30, 2018

this is ready for review


from retail.utils import programming_languages

warnings.filterwarnings("ignore", category=DeprecationWarning)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W291 trailing whitespace


import pytz
from marketing.models import Alumni, LeaderboardRank, Stat
from requests_oauthlib import OAuth2Session

programming_languages = ['css', 'solidity', 'python', 'javascript', 'ruby', 'html', 'design']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if we should include more programming languages?`

@@ -55,7 +55,7 @@ var promptForAuth = function(event) {

token_contract(tokenAddress).allowance.call(from, to, function(error, result) {
if (error || result.toNumber() == 0) {
_alert("You have not yet enabled this token. To enable this token, go to the <a style='padding-left:5px;' href='/settings/tokens'> Token Settings page and enable it</a>. (this is only needed one time per token)");
_alert({'message':"You have not yet enabled this token. To enable this token, go to the <a style='padding-left:5px;' href='/settings/tokens'> Token Settings page and enable it</a>. (this is only needed one time per token)"},'warning');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before value for key 'message'. (key-spacing)
A space is required after ','. (comma-spacing)

@ghost ghost assigned mbeacom Jul 3, 2018
pp.profile_time('alumni')
context['count_open'] = base_bounties.filter(network='mainnet', idx_status__in=['open']).count()
context['count_started'] = base_bounties.filter(network='mainnet', idx_status__in=['started', 'submitted']).count()
context['count_done'] = base_bounties.filter(network='mainnet', idx_status__in=['done']).count()
pp.profile_time('count_*')

# Leaderboard
context['top_orgs'] = LeaderboardRank.objects.filter(active=True, leaderboard='quarterly_orgs').order_by('rank').values_list('github_username', flat=True)
context['top_orgs'] = base_leaderboard.filter(active=True, leaderboard='quarterly_orgs').order_by('rank').values_list('github_username', flat=True)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (151 > 120 characters)

pp.profile_time('completion_rate')
bounty_abandonment_rate = round(100 - completion_rate, 1)
context['universe_total_usd'] = sum(base_bounties.filter(network='mainnet').values_list('_val_usd_db', flat=True))
pp.profile_time('universe_total_usd')
context['max_bounty_history'] = float(context['universe_total_usd']) * .7
context['bounty_abandonment_rate'] = f'{bounty_abandonment_rate}%'
context['bounty_average_turnaround'] = str(round(get_bounty_median_turnaround_time('turnaround_time_submitted')/24, 1)) + " days"
context['bounty_average_turnaround'] = str(round(get_bounty_median_turnaround_time('turnaround_time_submitted', keyword)/24, 1)) + " days"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (142 > 120 characters)

context['bounty_claimed_completion_rate'] = f'{completion_rate}%'
context['bounty_median_pickup_time'] = round(get_bounty_median_turnaround_time('turnaround_time_started'), 1)
context['bounty_median_pickup_time'] = round(get_bounty_median_turnaround_time('turnaround_time_started', keyword), 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (122 > 120 characters)

@owocki owocki merged commit 941812c into master Jul 4, 2018
@ghost ghost removed the in progress label Jul 4, 2018
@mbeacom mbeacom deleted the kevin/resultspage_by_keyword branch August 2, 2018 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants