Skip to content

Commit

Permalink
fix decimal type to be float instead of string
Browse files Browse the repository at this point in the history
  • Loading branch information
pkujawa committed Aug 20, 2024
1 parent c3d9e38 commit adbb7e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 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

0 comments on commit adbb7e7

Please sign in to comment.