Skip to content

Commit

Permalink
exclude records from update if there is no applicant (#1366)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhuseinov authored Jan 31, 2024
1 parent 0ed0f07 commit 0b1b99f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,27 @@ def _update_records(conn, batch_size, cursor, rows):
def _prepare_data(rows):
data_list = []
for row in rows:
data_list.append(_map_data(row))
parsed_data = _map_data(row)
if parsed_data:
data_list.append(parsed_data)

return data_list


def _map_data(row):
applicant = (
row.get("last_name") if row.get("last_name") else row.get("organization_name")
row.get("last_name")
if row.get("last_name", None)
else row.get("organization_name", None)
)

if applicant and row.get("owner_count_extension"):
applicant = f"{applicant} {row.get('owner_count_extension')}"
if applicant:
if row.get("owner_count_extension"):
applicant = f"{applicant} {row.get('owner_count_extension')}"

return {"applicant": applicant, "submission_uuid": row["submission_uuid"]}
return {"applicant": applicant, "submission_uuid": row["submission_uuid"]}

return None


_update_query = """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,27 @@ def _update_records(conn, batch_size, cursor, rows):
def _prepare_data(rows):
data_list = []
for row in rows:
data_list.append(_map_data(row))
parsed_data = _map_data(row)
if parsed_data:
data_list.append(parsed_data)

return data_list


def _map_data(row):
applicant = (
row.get("last_name") if row.get("last_name") else row.get("organization_name")
row.get("last_name")
if row.get("last_name", None)
else row.get("organization_name", None)
)

if applicant and row.get("owner_count_extension"):
applicant = f"{applicant} {row.get('owner_count_extension')}"
if applicant:
if row.get("owner_count_extension"):
applicant = f"{applicant} {row.get('owner_count_extension')}"

return {"applicant": applicant, "submission_uuid": row["submission_uuid"]}
return {"applicant": applicant, "submission_uuid": row["submission_uuid"]}

return None


_update_query = """
Expand Down

0 comments on commit 0b1b99f

Please sign in to comment.