mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 07:21:13 -05:00
merge from main again
This commit is contained in:
@@ -105,24 +105,23 @@ def extract_phones(job):
|
||||
current_app.logger.info(f"HEADERS {first_row}")
|
||||
phone_index = 0
|
||||
for item in first_row:
|
||||
if item.lower() == "phone number":
|
||||
# Note: may contain a BOM and look like \ufeffphone number
|
||||
if "phone number" in item.lower():
|
||||
break
|
||||
phone_index = phone_index + 1
|
||||
|
||||
phones = {}
|
||||
job_row = 0
|
||||
for row in job:
|
||||
row = row.split(",")
|
||||
# TODO WHY ARE WE CALCULATING PHONE INDEX IN THE LOOP?
|
||||
phone_index = 0
|
||||
for item in first_row:
|
||||
if item.lower() == "phone number":
|
||||
break
|
||||
phone_index = phone_index + 1
|
||||
current_app.logger.info(f"PHONE INDEX IS NOW {phone_index}")
|
||||
current_app.logger.info(f"LENGTH OF ROW IS {len(row)}")
|
||||
if phone_index >= len(row):
|
||||
phones[job_row] = "Error: can't retrieve phone number"
|
||||
current_app.logger.error("Corrupt csv file, missing columns job_id {job_id} service_id {service_id}")
|
||||
current_app.logger.error(
|
||||
"Corrupt csv file, missing columns or possibly a byte order mark in the file"
|
||||
)
|
||||
|
||||
else:
|
||||
my_phone = row[phone_index]
|
||||
my_phone = re.sub(r"[\+\s\(\)\-\.]*", "", my_phone)
|
||||
|
||||
Reference in New Issue
Block a user