Skip to content

Commit

Permalink
udpate idx_status -> status
Browse files Browse the repository at this point in the history
  • Loading branch information
thelostone-mc committed Jan 13, 2020
1 parent 6b31ed5 commit 6fb3196
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 20 deletions.
4 changes: 2 additions & 2 deletions app/dashboard/embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def embed(request):
.filter(
github_url__startswith=repo_url,
network='mainnet',
idx_status__in=['open']
bounty_state__in=['open']
)

tmpl = loader.get_template('svg_badge.txt')
Expand Down Expand Up @@ -163,7 +163,7 @@ def embed(request):
.filter(
github_url__startswith=repo_url,
network='mainnet',
idx_status__in=['open', 'started', 'submitted']
bounty_state__in=['open', 'work_started', 'work_submitted']
).order_by('-_val_usd_db')
bounties = super_bounties[:length]

Expand Down
4 changes: 3 additions & 1 deletion app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3004,7 +3004,9 @@ def completed_bounties(self):
"""
network = self.get_network()
return self.bounties.filter(
idx_status__in=['done'], network=network).count()
bounty_state__in=['done'],
network=network
).count()


@property
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ def open_bounties():
"""
from dashboard.models import Bounty
return Bounty.objects.current().filter(network='mainnet', idx_status__in=['open', 'submitted']).cache()
return Bounty.objects.current().filter(network='mainnet', bounty_state__in=['open', 'work_submitted']).cache()


def maybe_market_tip_to_github(tip):
Expand Down
6 changes: 3 additions & 3 deletions app/marketing/management/commands/bounty_feedback_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def handle(self, *args, **options):

start_time = timezone.now() - timezone.timedelta(hours=36)
end_time = timezone.now() - timezone.timedelta(hours=12)
statues = ['done', 'cancelled']
states = ['done', 'cancelled']
bounties_fulfilled_last_timeperiod = Bounty.objects.current().filter(
network='mainnet',
fulfillment_accepted_on__gt=start_time,
Expand Down Expand Up @@ -63,13 +63,13 @@ def handle(self, *args, **options):
fulfiller_email = accepted_fulfillment.fulfiller_email
is_fulfiller_and_funder_same_person = (fulfiller_email == submitter_email)
fulfillment_pks = BountyFulfillment.objects.filter(accepted=True, fulfiller_email=fulfiller_email).values_list('pk', flat=True)
previous_bounties = Bounty.objects.current().filter(idx_status__in=statues, fulfillments__pk__in=fulfillment_pks).exclude(pk=bounty.pk).distinct()
previous_bounties = Bounty.objects.current().filter(bounty_state__in=states, fulfillments__pk__in=fulfillment_pks).exclude(pk=bounty.pk).distinct()
has_been_sent_before_to_persona = previous_bounties.count()
if not has_been_sent_before_to_persona and not is_fulfiller_and_funder_same_person:
bounty_feedback(bounty, 'fulfiller', previous_bounties)

# send email to the funder
previous_bounties = Bounty.objects.filter(idx_status__in=statues, bounty_owner_email=submitter_email, current_bounty=True).exclude(pk=bounty.pk).distinct()
previous_bounties = Bounty.objects.filter(bounty_state__in=states, bounty_owner_email=submitter_email, current_bounty=True).exclude(pk=bounty.pk).distinct()
has_been_sent_before_to_persona = previous_bounties.count()
if not has_been_sent_before_to_persona and not is_fulfiller_and_funder_same_person:
bounty_feedback(bounty, 'funder', previous_bounties)
4 changes: 2 additions & 2 deletions app/marketing/management/commands/expiration_start_work.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def handle(self, *args, **options):
interested=interest,
project_type='traditional',
network='mainnet',
idx_status__in=['open', 'started'],
bounty_state__in=['open', 'work_started'],
permission_type='approval',
)
else:
Expand All @@ -86,7 +86,7 @@ def handle(self, *args, **options):
interested=interest,
project_type='traditional',
network='mainnet',
idx_status__in=['open', 'started'],
bounty_state__in=['open', 'work_started'],
permission_type='permissionless',
)

Expand Down
2 changes: 1 addition & 1 deletion app/marketing/management/commands/new_bounties_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_bounties_for_keywords(keywords, hours_back):
for keyword in keywords:
relevant_bounties = Bounty.objects.current().filter(
network='mainnet',
idx_status__in=['open'],
bounty_state__in=['open'],
).keyword(keyword).exclude(bounty_reserved_for_user__isnull=False)
for bounty in relevant_bounties.filter(web3_created__gt=(timezone.now() - timezone.timedelta(hours=hours_back))):
new_bounties_pks.append(bounty.pk)
Expand Down
6 changes: 2 additions & 4 deletions app/marketing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ def get_platform_wide_stats(since_last_n_days=90):
bounties = Bounty.objects.current().filter(network='mainnet', created_on__gte=last_n_days)
bounties = bounties.exclude(interested__isnull=True)
total_bounties = bounties.count()
completed_bounties = bounties.filter(idx_status__in=['done'])
terminal_state_bounties = bounties.filter(idx_status__in=['done', 'expired', 'cancelled'])
completed_bounties = bounties.filter(bounty_state__in=['done'])
terminal_state_bounties = bounties.filter(bounty_state__in=['done', 'expired', 'cancelled'])
num_completed_bounties = completed_bounties.count()
bounties_completion_percent = (num_completed_bounties / terminal_state_bounties.count()) * 100

Expand All @@ -290,8 +290,6 @@ def get_platform_wide_stats(since_last_n_days=90):
created_on__gte=last_n_days).order_by('-_val_usd_db').first()
largest_bounty_value = largest_bounty.value_in_usdt

bounty_fulfillments = BountyFulfillment.objects.filter(
accepted_on__gte=last_n_days).order_by('-bounty__value_in_token')[:5]
num_items = 10
hunters = LeaderboardRank.objects.active().filter(leaderboard='quarterly_earners').order_by('-amount')[0:num_items].values_list('github_username', flat=True)

Expand Down
15 changes: 9 additions & 6 deletions app/retail/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,13 @@ def get_history(base_stats, copy, num_months=6):

def get_completion_rate(keyword):
from dashboard.models import Bounty
base_bounties = Bounty.objects.current().filter(network='mainnet', idx_status__in=['done', 'expired', 'cancelled'])
base_bounties = Bounty.objects.current().filter(network='mainnet', bounty_state__in=['done', 'expired', 'cancelled'])
if keyword:
base_bounties = base_bounties.filter(raw_data__icontains=keyword)
eligible_bounties = base_bounties.filter(created_on__gt=(timezone.now() - timezone.timedelta(days=60)))
eligible_bounties = eligible_bounties.exclude(interested__isnull=True)
completed_bounties = eligible_bounties.filter(idx_status__in=['done']).count()
not_completed_bounties = eligible_bounties.filter(idx_status__in=['expired', 'cancelled']).count()
completed_bounties = eligible_bounties.filter(bounty_state__in=['done']).count()
not_completed_bounties = eligible_bounties.filter(bounty_state__in=['expired', 'cancelled']).count()
total_bounties = completed_bounties + not_completed_bounties

try:
Expand Down Expand Up @@ -268,7 +268,10 @@ def get_funder_receiver_stats(keyword):

def get_base_done_bounties(keyword):
from dashboard.models import Bounty
base_bounties = Bounty.objects.current().filter(network='mainnet', idx_status__in=['done', 'expired', 'cancelled'])
base_bounties = Bounty.objects.current().filter(
network='mainnet',
bounty_state__in=['done', 'expired', 'cancelled']
)
if keyword:
base_bounties = base_bounties.filter(raw_data__icontains=keyword)
return base_bounties
Expand Down Expand Up @@ -329,7 +332,7 @@ def get_hourly_rate_distribution(keyword, bounty_value_range=None, methodology=N

def get_bounty_median_turnaround_time(func='turnaround_time_started', keyword=None):
base_bounties = get_base_done_bounties(keyword)
eligible_bounties = base_bounties.exclude(idx_status='open') \
eligible_bounties = base_bounties.exclude(bounty_state='open') \
.filter(created_on__gt=(timezone.now() - timezone.timedelta(days=60)))
pickup_time_hours = []
for bounty in eligible_bounties:
Expand Down Expand Up @@ -496,7 +499,7 @@ def build_stat_results(keyword=None):
context['audience'] = json.loads(context['members_history'])[-1][1]
pp.profile_time('completion_rate')
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_bounties_usd = sum(base_bounties.exclude(bounty_state__in=['expired', 'cancelled']).values_list('_val_usd_db', flat=True))
total_tips_usd = sum([
tip.value_in_usdt
for tip in Tip.objects.filter(network='mainnet').send_happy_path() if tip.value_in_usdt
Expand Down

0 comments on commit 6fb3196

Please sign in to comment.