feat: fixed linting issues

This commit is contained in:
Muhammad Zubair
2023-06-22 19:07:25 +05:00
committed by Phillip Shiu
parent aefdc750a6
commit f674e35d1b

View File

@@ -67,17 +67,17 @@ def expire_old_entitlements(self, start, end, logid='...'):
def expire_and_create_entitlements(self, entitlements, support_user):
"""
Expire entitlements older than one year.
Exception: if the entitlement is for a course in a list of exceptional courses,
expire those entitlements if they're older than 18 months instead.
Then create a copy of the expired entitlement to renew it for another year
/ 18 months.
Args:
entitlements (QuerySet): A QuerySet with the entitlements to expire.
support_user (django.contrib.auth.models.user): The username to attribute the entitlement expiration and recreation to.
Returns:
None
@@ -97,13 +97,12 @@ def expire_and_create_entitlements(self, entitlements, support_user):
}
CourseEntitlementSupportDetail.objects.create(**support_detail)
# Creating new entitlement and support details
new_entitlement = {
# Creating new entitlement and support details
new_entitlement = {
'course_uuid': entitlement.course_uuid,
'user': entitlement.user,
'mode': entitlement.mode,
'refund_locked': True,
'refund_locked': True,
}
CourseEntitlement.objects.create(**new_entitlement)
support_detail = {
@@ -118,4 +117,5 @@ def expire_and_create_entitlements(self, entitlements, support_user):
except Exception as exc:
LOGGER.exception('Failed to expire entitlements that reached their expiration period',)
LOGGER.info('Successfully completed the task expire_and_create_entitlements after examining %d entries', entitlements.count()) # lint-amnesty, pylint: disable=line-too-long
LOGGER.info('Successfully completed the task expire_and_create_entitlements after examining %d entries', entitlements.count()) # lint-amnesty, pylint: disable=line-too-long