Skip to content

Commit

Permalink
psp-8252 remove unecessary cast from/to string
Browse files Browse the repository at this point in the history
  • Loading branch information
devinleighsmith committed May 1, 2024
1 parent 9b136c7 commit 192dd6e
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { PropertySelectorPidSearchContainerProps } from '@/components/propertySe
import PropertySearchSelectorPidFormView from '@/components/propertySelector/search/PropertySelectorPidSearchView';
import { AreaUnitTypes } from '@/constants/areaUnitTypes';
import { ApiGen_Concepts_Property } from '@/models/api/generated/ApiGen_Concepts_Property';
import { convertArea, exists, formatNumber } from '@/utils';
import { convertArea, exists } from '@/utils';

import MapSideBarLayout from '../layout/MapSideBarLayout';
import { AddressForm, PropertyForm } from '../shared/models';
Expand Down Expand Up @@ -70,11 +70,6 @@ const AddConsolidationView: React.FunctionComponent<
MapSelectorComponent,
PropertySelectorPidSearchComponent,
}) => {
const getAreaValue = (area: number, unit: string): number => {
const sqm = convertArea(area, unit, AreaUnitTypes.SquareMeters);
return Number(formatNumber(sqm, 0, 3));
};

return (
<MapSideBarLayout
showCloseButton
Expand Down Expand Up @@ -157,7 +152,11 @@ const AddConsolidationView: React.FunctionComponent<
const formProperty = PropertyForm.fromMapProperty(property);
formProperty.landArea =
property.landArea && property.areaUnit
? getAreaValue(property.landArea, property.areaUnit)
? convertArea(
property.landArea,
property.areaUnit.toLocaleLowerCase(),
AreaUnitTypes.SquareMeters,
)
: 0;
formProperty.areaUnit = AreaUnitTypes.SquareMeters;
if (property.pid) {
Expand Down

0 comments on commit 192dd6e

Please sign in to comment.