Skip to content

Data mapping: Postal code is always set to 00000 when blank #5130

@ebeers-png

Description

@ebeers-png

Describe the bug

In BEAM we noticed that while uploading a property, if the new data had a blank postal code, the blank value would become 00000 during the mapping process.

Before mapping:

Image

After mapping:

Image

I looked into the code and found that it happened at this step:

if mapped_column_name in {"postal_code", "owner_postal_code"}:
if "-" in str(column_value):
postal = str(column_value).split("-")[0].zfill(5)
ext = str(column_value).split("-")[1].zfill(4)
column_value = postal + "-" + ext
column_value = str(column_value).zfill(5)

Looking at the code's history, this block used to check for a column value first before zero-filling it. The commit message for the change is "Added leading zeros to 0 zip; modified test to do explicit check."

Image

It looks like if column_value: was removed just for testing, but accidentally left out in the final code. Does that sound right? Can we add if column_value back in here without issue? Or is it used for hashing?

Expected Behavior

When uploading a property with a blank postal code, the Postal Code column value will be blank.

Actual Behavior

When uploading a property with a blank postal code, the Postal Code column value is "00000".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions