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 6566 map search corrections #3338

Merged
merged 2 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion source/frontend/src/components/maps/hooks/useMapSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const useMapSearch = () => {
setModalContent({
title: 'Unable to connect to PIMS Inventory',
message:
'PIMS is unable to connect to connect to the PIMS Inventory map service. You may need to log out and log into the application in order to restore this functionality. If this error persists, contact a site administrator.',
'PIMS is unable to connect to the PIMS Inventory map service. You may need to log out and log into the application in order to restore this functionality. If this error persists, contact a site administrator.',
okButtonText: 'Log out',
cancelButtonText: 'Continue working',
handleOk: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export const useLayerQuery = (url: string, authenticated?: boolean): IUserLayerQ
requestFunction: useCallback(
async (pid: string, allBy?: boolean): Promise<AxiosResponse<FeatureCollection>> => {
//Do not make a request if we our currently cached response matches the requested pid.
const formattedPid = pid.replace(/-/g, '');
const formattedPid = pid.replace(/[-\s]/g, '').padStart(9, '0');
const data: AxiosResponse<FeatureCollection> = await wfsAxios({
timeout: 20000,
authenticated,
Expand All @@ -188,7 +188,9 @@ export const useLayerQuery = (url: string, authenticated?: boolean): IUserLayerQ
const data: AxiosResponse<FeatureCollection> = await wfsAxios({
timeout: 20000,
authenticated,
}).get<FeatureCollection>(`${allBy ? baseAllUrl : baseUrl}&${toCqlFilter({ PIN: pin })}`);
}).get<FeatureCollection>(
`${allBy ? baseAllUrl : baseUrl}&${toCqlFilter({ PIN: pin }, true)},`,
);
return data;
},
[baseAllUrl, baseUrl, authenticated],
Expand Down
2 changes: 2 additions & 0 deletions source/frontend/src/components/maps/leaflet/mapUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@
flags?.forceExactMatch
) {
cql.push(`${key} = '${object[key]}'`);
} else if (key === 'PIN' && flags?.forceExactMatch) {
cql.push(`${key}=${object[key].replace(/[^0-9]/g, '')}`);

Check warning on line 274 in source/frontend/src/components/maps/leaflet/mapUtils.tsx

View check run for this annotation

Codecov / codecov/patch

source/frontend/src/components/maps/leaflet/mapUtils.tsx#L274

Added line #L274 was not covered by tests
Copy link
Collaborator Author

@devinleighsmith devinleighsmith Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove all non-numerics for pins.

} else {
cql.push(`${key} ilike '%${object[key]}%'`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const useMapProperties = () => {
(params?: IGeoSearchParams) => {
const geoserver_params = {
STREET_ADDRESS_1: params?.STREET_ADDRESS_1,
PID_PADDED: params?.PID,
PID_PADDED: params?.PID?.replace(/[-\s]/g, ''),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove spaces and hyphens for pids.

PIN: params?.PIN,
};
const url = `${propertiesUrl}${
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const useFullyAttributedParcelMapLayer = (url: string, name: string) => {
const findByPid = useCallback(
async (pid: string, forceExactMatch = false) => {
// Removes dashes to match expectations of the map layer.
const formattedPid = pid.replace(/-/g, '');
const formattedPid = pid.replace(/[-\s]/g, '');
const data = await getAllFeatures(
{ PID: formattedPid },
{ forceExactMatch: forceExactMatch, timeout: 30000 },
Expand Down
Loading