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

CE-199-Refactoring of edit and geocoding functionality #181

Merged
merged 6 commits into from
Oct 30, 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
8 changes: 4 additions & 4 deletions backend/src/external_api/bc_geo_coder/bc_geo_coder.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class BcGeoCoderService {

// given a localityName (community, for example) and an address, return the Feature given by BC Geocoder
async findAll(localityName: string, addressString: string): Promise<Feature> {
const maxResults = 10;
const maxResults = 1; // will need to update this for the purposes of autocomplete.
let apiUrl: string;
this.logger.debug(
`Calling BC Geocoder. Parameters sent to backend were localityName: ${localityName} and addressString: ${addressString}`
Expand All @@ -21,13 +21,13 @@ export class BcGeoCoderService {
this.logger.debug(
`Calling BC Geocoder with address ${addressString} and community ${localityName}`
);
apiUrl = `${process.env.BC_GEOCODER_API_URL}/addresses.json?addressString=${addressString}&locationDescriptor=any&maxResults=${maxResults}&interpolation=adaptive&echo=true&brief=false&autoComplete=true&setBack=0&outputSRS=4326&minScore=2&localityName=${localityName}&provinceCode=BC`;
apiUrl = `${process.env.BC_GEOCODER_API_URL}/addresses.json?addressString=${addressString}&locationDescriptor=any&maxResults=${maxResults}&interpolation=adaptive&echo=true&brief=false&autoComplete=true&setBack=0&outputSRS=4326&minScore=1&localityName=${localityName}&provinceCode=BC`;
} else if (localityName) {
this.logger.debug(`Calling BC Geocoder with community ${localityName}`);
apiUrl = `${process.env.BC_GEOCODER_API_URL}/addresses.json?locationDescriptor=any&maxResults=${maxResults}&interpolation=adaptive&echo=true&brief=false&autoComplete=true&setBack=0&outputSRS=4326&minScore=2&localityName=${localityName}&provinceCode=BC`;
apiUrl = `${process.env.BC_GEOCODER_API_URL}/addresses.json?locationDescriptor=any&maxResults=${maxResults}&interpolation=adaptive&echo=true&brief=false&autoComplete=false&setBack=0&outputSRS=4326&minScore=1&localityName=${localityName}&provinceCode=BC`;
} else if (addressString && addressString.length > 0) {
this.logger.debug(`Calling BC Geocoder with address ${addressString}`);
apiUrl = `${process.env.BC_GEOCODER_API_URL}/addresses.json?addressString=${addressString}&locationDescriptor=any&maxResults=${maxResults}&interpolation=adaptive&echo=true&brief=false&autoComplete=true&setBack=0&outputSRS=4326&minScore=2&provinceCode=BC`;
apiUrl = `${process.env.BC_GEOCODER_API_URL}/addresses.json?addressString=${addressString}&locationDescriptor=any&maxResults=${maxResults}&interpolation=adaptive&echo=true&brief=false&autoComplete=true&setBack=0&outputSRS=4326&minScore=1&provinceCode=BC`;
}
if (apiUrl) {
const apiKey = process.env.BC_GEOCODER_API_URL;
Expand Down
8 changes: 1 addition & 7 deletions frontend/cypress/e2e/allegation-details.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,8 @@ describe("COMPENF-37 Display ECR Details", () => {
cy.get('span[id="comp-details-region"]').contains(callDetails.region);
});

it("it has a map on screen with a marker at the correct location", function () {
cy.navigateToEditScreen(COMPLAINT_TYPES.ERS,"23-006888");
cy.verifyMapMarkerExists(true);
cy.get(".comp-complaint-details-alert").should("not.exist");
});

it("it has a map on screen with no marker", function () {
cy.navigateToEditScreen(COMPLAINT_TYPES.ERS,"23-032528");
cy.navigateToDetailsScreen(COMPLAINT_TYPES.ERS,"23-032528");
cy.verifyMapMarkerExists(false);
cy.get(".comp-complaint-details-alert").should("exist");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CreatableSelect from "react-select/creatable";
import { useAppDispatch, useAppSelector } from "../../hooks/hooks";
import {
getComplaintLocationByAddress,
selectComplaintLocation,
selectGeocodedComplaintCoordinates,
} from "../../store/reducers/complaints";

interface Props {
Expand Down Expand Up @@ -40,7 +40,7 @@ export const BCGeocoderAutocomplete: FC<Props> = ({
};

const dispatch = useAppDispatch();
const complaintLocation = useAppSelector(selectComplaintLocation);
const complaintLocation = useAppSelector(selectGeocodedComplaintCoordinates);

useEffect(() => {
const fetchAddresses = async (inputValue: string) => {
Expand Down
Loading