Skip to content

Commit bec6c5a

Browse files
authored
Fix habitat value in occurrence upload (#4224)
1 parent 7da84bf commit bec6c5a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

bims/scripts/occurrences_upload.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -695,13 +695,16 @@ def process_data(self, row):
695695
row, PRESENT))
696696

697697
# -- Optional data - Habitat
698-
if HABITAT in row and DataCSVUpload.row_value(row, HABITAT):
698+
habitat_value = DataCSVUpload.row_value(row, HABITAT)
699+
if HABITAT in row and habitat_value:
699700
habitat_choices = {
700701
v: k for k, v in
701702
BiologicalCollectionRecord.HABITAT_CHOICES
702703
}
704+
if habitat_value in habitat_choices:
705+
habitat_value = habitat_choices[habitat_value]
703706
optional_data['collection_habitat'] = (
704-
habitat_choices[DataCSVUpload.row_value(row, HABITAT)]
707+
habitat_value
705708
)
706709

707710
# -- Optional data - Sampling method

0 commit comments

Comments
 (0)