Skip to content

Commit

Permalink
Merge pull request #4159 from unicef/staging
Browse files Browse the repository at this point in the history
STG -> DEV
  • Loading branch information
patryk-dabrowski authored Aug 23, 2024
2 parents 3590ad6 + 956e5a2 commit 9b0c985
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def _get_form_field_for_value(self, flexible_attribute: FlexibleAttribute) -> fo
if flexible_attribute.pdu_data.subtype == PeriodicFieldData.STRING:
return forms.CharField(required=False)
elif flexible_attribute.pdu_data.subtype == PeriodicFieldData.DECIMAL:
return forms.DecimalField(required=False)
return forms.FloatField(required=False)
elif flexible_attribute.pdu_data.subtype == PeriodicFieldData.BOOLEAN:
return StrictBooleanField(required=False)
elif flexible_attribute.pdu_data.subtype == PeriodicFieldData.DATE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def test_import_data_decimal(self) -> None:
self.assertEqual(periodic_data_update_upload.status, PeriodicDataUpdateUpload.Status.SUCCESSFUL)
self.assertEqual(periodic_data_update_upload.error_message, None)
self.individual.refresh_from_db()
self.assertEqual(self.individual.flex_fields[flexible_attribute.name]["1"]["value"], "20.456")
self.assertEqual(self.individual.flex_fields[flexible_attribute.name]["1"]["value"], 20.456)
self.assertEqual(self.individual.flex_fields[flexible_attribute.name]["1"]["collection_date"], "2021-05-02")

def test_import_data_boolean(self) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def handle_pdu_fields(self, row: list[Any], header: list[Any], individual: Pendi
collection_date_cell = row_dict.get(column_collection_date)
subtype = flexible_attribute.pdu_data.subtype
handle_subtype = handle_subtype_mapping[subtype]
value = handle_subtype(value_cell)
value = handle_subtype(value_cell, is_flex_field=True)
if not collection_date_cell.value:
collection_date = self.registration_data_import.created_at.date()
else:
Expand Down

0 comments on commit 9b0c985

Please sign in to comment.