From ca57043437a8747d8cb77112b8209bb739f0ab30 Mon Sep 17 00:00:00 2001 From: Andrew Stoltman Date: Wed, 1 Jun 2022 12:57:08 -0400 Subject: [PATCH 1/2] Resolved #387: Fixed bug that would only update allocation statuses of 'active' to 'expired', other statuses would stay as their current status after expiration date was reached. --- coldfront/core/allocation/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coldfront/core/allocation/tasks.py b/coldfront/core/allocation/tasks.py index f46733251..0ba9d8c65 100644 --- a/coldfront/core/allocation/tasks.py +++ b/coldfront/core/allocation/tasks.py @@ -31,7 +31,7 @@ def update_statuses(): expired_status_choice = AllocationStatusChoice.objects.get( name='Expired') allocations_to_expire = Allocation.objects.filter( - status__name='Active', end_date__lt=datetime.datetime.now().date()) + end_date__lt=datetime.datetime.now().date()) for sub_obj in allocations_to_expire: sub_obj.status = expired_status_choice sub_obj.save() From cc101e392c28f25b1df7c0d9f54ed5e8ad5152b6 Mon Sep 17 00:00:00 2001 From: Andrew Stoltman Date: Fri, 3 Jun 2022 14:32:20 -0400 Subject: [PATCH 2/2] Fix bug to allow correct statuses to become expired --- coldfront/core/allocation/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coldfront/core/allocation/tasks.py b/coldfront/core/allocation/tasks.py index 0ba9d8c65..d56f807e7 100644 --- a/coldfront/core/allocation/tasks.py +++ b/coldfront/core/allocation/tasks.py @@ -31,7 +31,7 @@ def update_statuses(): expired_status_choice = AllocationStatusChoice.objects.get( name='Expired') allocations_to_expire = Allocation.objects.filter( - end_date__lt=datetime.datetime.now().date()) + status__name__in=['Active','Payment Pending','Payment Requested', 'Unpaid',], end_date__lt=datetime.datetime.now().date()) for sub_obj in allocations_to_expire: sub_obj.status = expired_status_choice sub_obj.save()