Skip to content

Commit

Permalink
fix a couple instances... still need to fix availablePlans
Browse files Browse the repository at this point in the history
  • Loading branch information
ajay-sentry authored and RulaKhaled committed Jan 20, 2025
1 parent 1f2e63b commit 5050704
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion api/internal/owner/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@ def update(self, instance: Owner, validated_data: Dict[str, Any]) -> object:
instance, desired_plan
)

sentry_plans = Plan.objects.filter(tier=TierName.Sentry.value)
sentry_plans = Plan.objects.filter(
tier=TierName.SENTRY.value, is_active=True
)

if desired_plan["value"] in sentry_plans:
current_owner = self.context["view"].request.current_owner
Expand Down
5 changes: 4 additions & 1 deletion codecov_auth/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,10 @@ class OwnerAdmin(AdminMixin, admin.ModelAdmin):

def get_form(self, request, obj=None, change=False, **kwargs):
form = super().get_form(request, obj, change, **kwargs)
PLANS_CHOICES = [(x, x) for x in Plan.objects.values_list("name", flat=True)]
PLANS_CHOICES = [
(x, x)
for x in Plan.objects.filter(is_active=True).values_list("name", flat=True)
]
form.base_fields["plan"].widget = Select(
choices=BLANK_CHOICE_DASH + PLANS_CHOICES
)
Expand Down

0 comments on commit 5050704

Please sign in to comment.