Skip to content

Commit

Permalink
fixed incorrect handling of removing coordinates (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
marqueone-ps authored Sep 29, 2023
1 parent 28c1f8d commit 6045c2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,14 @@ export const ComplaintDetails: FC = () => {
Coordinates.Latitude
] = parseFloat(latitude);
setUpdateComplaint(complaint);
} else if (latitude === "" && longitude === "") {
complaint.complaint_identifier.location_geometry_point.coordinates[
Coordinates.Longitude
] = 0
complaint.complaint_identifier.location_geometry_point.coordinates[
Coordinates.Latitude
] = 0
setUpdateComplaint(complaint);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ export const ComplaintDetailsEdit: FC<ComplaintDetailsProps> = ({
}

let result = type === Coordinates.Latitude ? input[0] : input[1]

return result.toString();
return result === 0 || result === "0" ? "" : result.toString();
};

const [latitude, setLatitude] = useState<string>(getEditableCoordinates(coordinates, Coordinates.Longitude));
Expand Down Expand Up @@ -594,7 +593,7 @@ export const ComplaintDetailsEdit: FC<ComplaintDetailsProps> = ({
type="input"
label="Y Coordinate"
containerClass="comp-details-edit-input"
formClass="comp-details-label-input-pair comp-margin-top-30"
formClass="comp-details-label-input-pair"
inputClass="comp-form-control"
value={latitude}
error={geoPointYMsg}
Expand Down

0 comments on commit 6045c2d

Please sign in to comment.