diff --git a/app/dashboard/embed.py b/app/dashboard/embed.py index 1a4508a7e26..efef87f9bfc 100644 --- a/app/dashboard/embed.py +++ b/app/dashboard/embed.py @@ -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') @@ -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] diff --git a/app/dashboard/models.py b/app/dashboard/models.py index f0673750414..42e3bf85e88 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -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 diff --git a/app/dashboard/notifications.py b/app/dashboard/notifications.py index aaee402716e..608b12af1de 100644 --- a/app/dashboard/notifications.py +++ b/app/dashboard/notifications.py @@ -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): diff --git a/app/marketing/management/commands/bounty_feedback_email.py b/app/marketing/management/commands/bounty_feedback_email.py index bfa99660d38..b2a7817934f 100644 --- a/app/marketing/management/commands/bounty_feedback_email.py +++ b/app/marketing/management/commands/bounty_feedback_email.py @@ -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, @@ -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) diff --git a/app/marketing/management/commands/expiration_start_work.py b/app/marketing/management/commands/expiration_start_work.py index b322d267908..6d8bbc8d230 100644 --- a/app/marketing/management/commands/expiration_start_work.py +++ b/app/marketing/management/commands/expiration_start_work.py @@ -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: @@ -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', ) diff --git a/app/marketing/management/commands/new_bounties_email.py b/app/marketing/management/commands/new_bounties_email.py index 4071c87f1b5..47b6d9d884b 100644 --- a/app/marketing/management/commands/new_bounties_email.py +++ b/app/marketing/management/commands/new_bounties_email.py @@ -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) diff --git a/app/marketing/utils.py b/app/marketing/utils.py index c90e8e177d8..16852d36596 100644 --- a/app/marketing/utils.py +++ b/app/marketing/utils.py @@ -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 @@ -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) diff --git a/app/retail/utils.py b/app/retail/utils.py index ec76ba098cb..806ef723a89 100644 --- a/app/retail/utils.py +++ b/app/retail/utils.py @@ -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: @@ -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 @@ -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: @@ -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