Skip to content

Commit

Permalink
allow markers with no pids to be opened/viewed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Smith authored and Smith committed Oct 19, 2023
1 parent 23eb48e commit 4ed9122
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const MapStateMachineProvider: React.FC<React.PropsWithChildren<unknown>>
} else if (event.type === 'MAP_MARKER_CLICK') {
latLng = event.featureSelected.latlng;
}
const result = locationLoader.loadLocationDetails(latLng);
const result = locationLoader.loadLocationDetails(latLng, event.featureSelected);

Check warning on line 104 in source/frontend/src/components/common/mapFSM/MapStateMachineContext.tsx

View check run for this annotation

Codecov / codecov/patch

source/frontend/src/components/common/mapFSM/MapStateMachineContext.tsx#L104

Added line #L104 was not covered by tests

return result;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { WHSE_Municipalities_Feature_Properties } from '@/models/layers/municipa
import { PMBC_FullyAttributed_Feature_Properties } from '@/models/layers/parcelMapBC';
import { PIMS_Property_Location_View } from '@/models/layers/pimsPropertyLocationView';

import { FeatureSelected } from './models';

export interface LocationFeatureDataset {
location: LatLngLiteral;
pimsFeature: Feature<Geometry, PIMS_Property_Location_View> | null;
Expand All @@ -37,7 +39,10 @@ const useLocationFeatureLoader = () => {
adminLegalBoundaryLayerService.findOneMunicipality;

const loadLocationDetails = useCallback(
async (latLng: LatLngLiteral): Promise<LocationFeatureDataset> => {
async (
latLng: LatLngLiteral,
selectedFeature: FeatureSelected,
): Promise<LocationFeatureDataset> => {

Check warning on line 45 in source/frontend/src/components/common/mapFSM/useLocationFeatureLoader.tsx

View check run for this annotation

Codecov / codecov/patch

source/frontend/src/components/common/mapFSM/useLocationFeatureLoader.tsx#L45

Added line #L45 was not covered by tests
const result: LocationFeatureDataset = {
location: latLng,
pimsFeature: null,
Expand All @@ -63,6 +68,11 @@ const useLocationFeatureLoader = () => {
| undefined = undefined;

// Load PimsProperties
if (selectedFeature?.pimsLocationFeature?.PROPERTY_ID) {
pimsLocationProperties = await loadProperties({

Check warning on line 72 in source/frontend/src/components/common/mapFSM/useLocationFeatureLoader.tsx

View check run for this annotation

Codecov / codecov/patch

source/frontend/src/components/common/mapFSM/useLocationFeatureLoader.tsx#L71-L72

Added lines #L71 - L72 were not covered by tests
PROPERTY_ID: selectedFeature.pimsLocationFeature.PROPERTY_ID,
});
}
if (parcelFeature !== undefined) {
pimsLocationProperties = await loadProperties({
PID: parcelFeature.properties?.PID || '',
Expand Down
1 change: 1 addition & 0 deletions source/frontend/src/constants/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface IGeoSearchParams {
PIN?: string;
SURVEY_PLAN_NUMBER?: string;
BBOX?: string;
PROPERTY_ID?: string;
latitude?: number | string;
longitude?: number | string;
forceExactMatch?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export const MotiInventoryContainer: React.FunctionComponent<

const composedPropertyState = useComposedProperties({
id: props.id,
pid: props?.pid === undefined || isNaN(+props.pid) ? undefined : +props.pid,
pid:
props?.pid === undefined || props?.pid === '' || isNaN(+props.pid) ? undefined : +props.pid,
propertyTypes: [
PROPERTY_TYPES.ASSOCIATIONS,
PROPERTY_TYPES.LTSA,
Expand Down
5 changes: 4 additions & 1 deletion source/frontend/src/hooks/layer-api/layerUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export const toCqlFilterValue = (object: Record<string, string>, flags?: IWfsCql
const cql: string[] = [];
Object.keys(object).forEach((key: string) => {
if (object[key]) {
if (
if (key === 'PROPERTY_ID') {
cql.push(`${key} = '${object[key]}'`);
return;

Check warning on line 28 in source/frontend/src/hooks/layer-api/layerUtils.ts

View check run for this annotation

Codecov / codecov/patch

source/frontend/src/hooks/layer-api/layerUtils.ts#L27-L28

Added lines #L27 - L28 were not covered by tests
} else if (
((key === 'PID' || key === 'PID_PADDED') && object[key]?.length === 9) ||
flags?.forceExactMatch
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const useMapProperties = () => {
STREET_ADDRESS_1: params?.STREET_ADDRESS_1,
PID_PADDED: params?.PID?.replace(/[-\s]/g, ''),
PIN: params?.PIN,
PROPERTY_ID: params?.PROPERTY_ID,
};
const url = `${propertiesUrl}${
geoserver_params ? toCqlFilter(geoserver_params, params?.forceExactMatch) : ''
Expand Down

0 comments on commit 4ed9122

Please sign in to comment.