Skip to content

Commit 9c5a593

Browse files
committed
Fix not being able to assign credit outside window
1 parent fba901e commit 9c5a593

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

coral_credits/api/db_utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,13 @@ def get_all_active_reservations(resource_provider_account):
7171

7272
def get_credit_allocation(id):
7373
now = timezone.now()
74-
try:
75-
credit_allocation = models.CreditAllocation.objects.filter(
76-
id=id, start__lte=now, end__gte=now
74+
75+
credit_allocation = models.CreditAllocation.objects.filter(
76+
id=id
7777
).first()
78-
except models.CreditAllocation.DoesNotExist:
78+
if credit_allocation == None:
7979
raise db_exceptions.NoCreditAllocation("Invalid allocation_id")
80+
8081
return credit_allocation
8182

8283

0 commit comments

Comments
 (0)