diff --git a/app/aws/s3.py b/app/aws/s3.py index 86676f3fc..e5311207c 100644 --- a/app/aws/s3.py +++ b/app/aws/s3.py @@ -101,8 +101,12 @@ def get_phone_number_from_s3(service_id, job_id, job_row_number): # At the same time we don't want to store it in redis or the db # So this is a little recycling mechanism to reduce the number of downloads. job = JOBS.get(job_id) + # TODO REMOVE + current_app.logger.info(f"HERE IS THE JOB FROM CACHE {job}") if job is None: job = get_job_from_s3(service_id, job_id) + # TODO REMOVE + current_app.logger.info(f"HERE IS THE JOB FROM S3 {job}") JOBS[job_id] = job incr_jobs_cache_misses() else: @@ -117,9 +121,17 @@ def get_phone_number_from_s3(service_id, job_id, job_row_number): if item == "phone number": break phone_index = phone_index + 1 + correct_row = job[job_row_number] correct_row = correct_row.split(",") + # TODO REMOVE + current_app.logger.info( + f"HERE IS THE CORRECT ROW AND PHONE INDEX {correct_row} {phone_index}" + ) + # This could happen if an old job cannot be retrieved from s3 + if len(correct_row) <= phone_index: + return "Unknown Phone" my_phone = correct_row[phone_index] my_phone = re.sub(r"[\+\s\(\)\-\.]*", "", my_phone) return my_phone