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

Fix saving complaints with coordinates - Bug/CE-447 #276

Merged
merged 2 commits into from
Feb 7, 2024
Merged

Conversation

dmitri-korin-bcps
Copy link
Contributor

@dmitri-korin-bcps dmitri-korin-bcps commented Feb 7, 2024

Description

When attempting to create a complaint with coordinates the application displays a toast “Unable to create complaint” and fails to save the complaint data.

The issue occurs because on the backend PostGIS fails to create geometry object from the input JSON if the object type is not passed. To fix the issue I modified a front-end component to have the object type in addition to coordinates.

Fixes # (CE-447)

How Has This Been Tested?

  • Click to create a new complaint. Enter all mandatory fields. Enter coordinates (X = -123.470769, Y = 48.500560). Click Save Changes. The result is complaint created, with a pin on the map matching the entered coordinates.

Checklist

  • I have added a new Cypress test hwcr-details-create-enter-coordinates.cy.ts that prove my fix is effective. It passed when ran locally.
  • New and existing unit tests pass locally with my changes

Thanks for the PR!

Any successful deployments (not always required) will be available below.
Backend available
Frontend available

Once merged, code will be promoted and handed off to following workflow run.
Main Merge Workflow

Copy link

sonarcloud bot commented Feb 7, 2024

Quality Gate Failed Quality Gate failed

Failed conditions

94.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link
Collaborator

@afwilcox afwilcox left a comment

Choose a reason for hiding this comment

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

I'm not sure we need a whole new test for this. I think you can just add the coordinates to allegation-details-create.cy.ts and hwcr-details-create.cy.ts

cy.get("#comp-details-edit-x-coordinate-input").click({ force: true });
cy.get("#comp-details-edit-x-coordinate-input").clear().type(createCallDetails.xCoord);

cy.get("#comp-details-edit-y-coordinate-input").click({ force: true });
cy.get("#comp-details-edit-y-coordinate-input").clear().type(createCallDetails.yCoord);

@dmitri-korin-bcps
Copy link
Contributor Author

We can add coordinates to the existing tests. However, these tests also accept an address via “Location” field. The app then passes the address to Geocoder and gets the coordinates. If we provide both an address and coordinates the app will bypass address extraction/validation and just use the coordinates we passed. I guess we may still want to preserve the test case when coordinates are obtained from the address and have a separate test with input coordinates. Let me know if otherwise.

Copy link
Collaborator

@afwilcox afwilcox left a comment

Choose a reason for hiding this comment

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

Okay thanks that makes sense.

@afwilcox afwilcox added this pull request to the merge queue Feb 7, 2024
Merged via the queue into main with commit ad5cc9c Feb 7, 2024
16 of 18 checks passed
@afwilcox afwilcox deleted the bug/CE-447 branch February 7, 2024 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants