feat: resolved linting issues
This commit is contained in:
committed by
Phillip Shiu
parent
2887e8967e
commit
33bc48b8de
@@ -64,7 +64,7 @@ class Command(BaseCommand):
|
||||
|
||||
while total > 0:
|
||||
total = total - batch_size
|
||||
no_of_entitlements = min(total, batch_size)
|
||||
no_of_entitlements = min(total, batch_size)
|
||||
expire_and_create_entitlements.delay(no_of_entitlements)
|
||||
|
||||
logger.info('Done. Successfully enqueued %d tasks.', num_batches)
|
||||
|
||||
@@ -10,7 +10,6 @@ from django.conf import settings # lint-amnesty, pylint: disable=unused-import
|
||||
from edx_django_utils.monitoring import set_code_owner_attribute
|
||||
|
||||
from common.djangoapps.entitlements.models import CourseEntitlement
|
||||
from common.djangoapps.entitlements.rest_api.v1.views import EntitlementViewSet
|
||||
|
||||
LOGGER = get_task_logger(__name__)
|
||||
|
||||
@@ -72,7 +71,7 @@ def expire_old_entitlements(self, start, end, logid='...'):
|
||||
raise self.retry(exc=exc, countdown=countdown, max_retries=MAX_RETRIES)
|
||||
|
||||
LOGGER.info('Successfully completed the task expire_old_entitlements after examining %d entries [%s]', entitlements.count(), logid) # lint-amnesty, pylint: disable=line-too-long
|
||||
|
||||
|
||||
|
||||
@shared_task(bind=True, ignore_result=True)
|
||||
@set_code_owner_attribute
|
||||
@@ -93,16 +92,14 @@ def expire_and_create_entitlements(self, no_of_entitlements):
|
||||
current_date = date.today()
|
||||
expiration_period = current_date - relativedelta(years=1)
|
||||
exceptional_expiration_period = current_date - relativedelta(years=1, months=6)
|
||||
normal_entitlements = CourseEntitlement.objects.filter(expired_at__isnull=True,
|
||||
created__lte=expiration_period).exclude(course_uuid__in=MIT_SUPPLY_CHAIN_COURSES)
|
||||
exceptional_entitlements = CourseEntitlement.objects.filter(expired_at__isnull=True,
|
||||
created__lte=exceptional_expiration_period, course_uuid__in=MIT_SUPPLY_CHAIN_COURSES)
|
||||
|
||||
normal_entitlements = CourseEntitlement.objects.filter(
|
||||
expired_at__isnull=True, created__lte=expiration_period).exclude(course_uuid__in=MIT_SUPPLY_CHAIN_COURSES)
|
||||
exceptional_entitlements = CourseEntitlement.objects.filter(
|
||||
expired_at__isnull=True, created__lte=exceptional_expiration_period, course_uuid__in=MIT_SUPPLY_CHAIN_COURSES)
|
||||
|
||||
entitlements = normal_entitlements | exceptional_entitlements
|
||||
|
||||
countdown = 2 ** self.request.retries
|
||||
|
||||
|
||||
try:
|
||||
for entitlement in entitlements[:no_of_entitlements]:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user