Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

psp-8252 remove unecessary cast from/to string #3984

Merged
merged 1 commit into from
May 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading