Commit 7e55437d by Calen Pennington

Allow retry_failed_photo_verifications to take a list of receipt_ids to retry

parent e57619b0
......@@ -11,13 +11,31 @@ class Command(BaseCommand):
This method finds those PhotoVerifications with a status of
MUST_RETRY and attempts to verify them.
"""
help = 'Retries SoftwareSecurePhotoVerifications that are in a state of \'must_retry\''
args = "<SoftwareSecurePhotoVerification id, SoftwareSecurePhotoVerification id, ...>"
help = (
"Retries SoftwareSecurePhotoVerifications passed as "
"arguments, or if no arguments are supplied, all that "
"are in a state of 'must_retry'"
)
def handle(self, *args, **options):
attempts_to_retry = SoftwareSecurePhotoVerification.objects.filter(status='must_retry')
if args:
attempts_to_retry = SoftwareSecurePhotoVerification.objects.filter(
receipt_id__in=args
)
force_must_retry = True
else:
attempts_to_retry = SoftwareSecurePhotoVerification.objects.filter(status='must_retry')
force_must_retry = False
print("Attempting to retry {0} failed PhotoVerification submissions".format(len(attempts_to_retry)))
for index, attempt in enumerate(attempts_to_retry):
print("Retrying submission #{0} (ID: {1}, User: {2})".format(index, attempt.id, attempt.user))
# Set the attempts status to 'must_retry' so that we can re-submit it
if force_must_retry:
attempt.status = 'must_retry'
attempt.submit(copy_id_photo_from=attempt.copy_id_photo_from)
print("Retry result: {0}".format(attempt.status))
print("Done resubmitting failed photo verifications")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment