SEED-platform / seed

Standard Energy Efficiency Data (SEED) Platform™ is a web-based application that helps organizations easily manage data on the energy performance of large groups of buildings.
Other
111 stars 54 forks source link

Extra_data text fields strip prepended zeros #4728

Open axelstudios opened 4 months ago

axelstudios commented 4 months ago

Describe the bug If you import zip code data into an extra_data column and set that column's data type to text, the data will appear in the json data correctly, but when requesting the data on the inventory list page (POST /api/v3/properties/filter/) it is returned without the prepended zeros for zip codes that start with zero.

Expected Behavior Text columns should return the exact value from the database

Actual Behavior Prepended zeros are being stripped

Steps to Reproduce

  1. Import the following csv
Custom ID 1,Custom Postal Code
1,00123
2,01010
  1. Set the Custom Postal Code column data type to text
  2. Go to the inventory list view, note that the full 5 digits are not shown
    1. Check that the database has all 5 digits in the extra_data column
    2. Inspect the API response for missing digits
RDmitchell commented 4 months ago

@axelstudios -- is there a case where the zip code would be defined as a number or alpha-numeric, so that it sorts properly numerically? Or maybe that sorting happens if it is set to text?