Brendiem / ala-citizenscience

Automatically exported from code.google.com/p/ala-citizenscience
0 stars 1 forks source link

Decimal attributes have 12 decimal place precision #318

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Enter a value for a decimal attribute as 1.25
2. View the record

What is the expected output? What do you see instead?
Your attribute value will show as 1.250000000000, but should show as entered 
(1.25)

Original issue reported on code.google.com by stepha...@gaiaresources.com.au on 24 Jul 2012 at 3:10

GoogleCodeExporter commented 9 years ago
This is due to a database migration that set the precision on the numeric value 
for attributes to 12 decimal places.

The solution is to use .stripTrailingZeros().toPlainString() to first strip the 
zeroes from the end of the number and then to prevent the number from showing 
in scientific notation.

The scientific notation prevention is necessary for entries of 0, which are not 
stripped and will be retrieved as 0E-12, which will cause a validation error.

Original comment by stepha...@gaiaresources.com.au on 24 Jul 2012 at 3:13

GoogleCodeExporter commented 9 years ago
Resolved in r380

Original comment by stepha...@gaiaresources.com.au on 25 Jul 2012 at 1:42