-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Describe the bug
Starting in v7.11.2, we are introducing a new feature where "trim zeros" can be applied to a field in a table format. This is fine, but this indicates to the user that they can trim zeros (which is most commonly requested in the case of latitude1 and longitude1, where leading zeros indicate false precision #1909). I tried to use this feature for this purpose, but found that it removed all data after the decimal point instead.
I created a Locality table format (included below), ran it on v7.11.2-prerelease (live on sp7demofish.specifycloud.org) and found that all data after the decimal point was lost. This should be resolved before release.
Failing
<format name="dwc:footprintWKT" title="dwc:footprintWKT" class="edu.ku.brc.specify.datamodel.Locality" default="">
<switch single="false" field="latLongType">
<!-- POINT -->
<fields value="Point">
<field sep="POINT (" trimzeros="true">longitude1</field>
<field sep=" " trimzeros="true">latitude1</field>
<field>discipline.division.iconURI</field>
</fields>
<!-- LINESTRING -->
<fields value="Line">
<field sep="LINESTRING (" trimzeros="true">longitude1</field>
<field sep=" " trimzeros="true">latitude1</field>
<field sep=", " trimzeros="true">longitude2</field>
<field sep=" " trimzeros="true">latitude2</field>
<field>discipline.division.iconURI</field>
</fields>
<fields value="Rectangle">
<field sep="POLYGON ((" trimzeros="true">longitude1</field>
<field sep=", " trimzeros="true">longitude2</field>
<field sep=" " trimzeros="true">latitude2</field>
<field sep=", " trimzeros="true">longitude1</field>
<field sep=" " trimzeros="true">latitude1</field>
<field sep=")">discipline.division.iconURI</field>
</fields>
</switch>
</format>
Working
<format name="dwc:footprintWKT" title="dwc:footprintWKT" class="edu.ku.brc.specify.datamodel.Locality" default="">
<switch single="false" field="latLongType">
<!-- POINT -->
<fields value="Point">
<field sep="POINT (">longitude1</field>
<field sep=" ">latitude1</field>
<field sep="">discipline.division.iconURI</field>
</fields>
<!-- LINESTRING -->
<fields value="Line">
<field sep="LINESTRING (">longitude1</field>
<field sep=" ">latitude1</field>
<field sep=", ">longitude2</field>
<field sep=" ">latitude2</field>
<field sep="">discipline.division.iconURI</field>
</fields>
<fields value="Rectangle">
<field sep="POLYGON ((">longitude1</field>
<field sep=", ">longitude2</field>
<field sep=" ">latitude2</field>
<field sep=", ">longitude1</field>
<field sep=" ">latitude1</field>
<field sep=")">discipline.division.iconURI</field>
</fields>
</switch>
</format>Expected behavior
Best case scenario, this option should remove leading and trailing zeros, see #1909.
Acceptable resolution is to simply rename it "Trim Leading Zeros" instead of "Trim Zeros", but it should still not hide all data after the decimal point.