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

Fixed: Zip codes starting with 0 now generate the latitude and longitude correctly(#320) #331

Merged
merged 5 commits into from
Nov 7, 2024
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
5 changes: 4 additions & 1 deletion src/components/FacilityGeoPointModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,13 @@ export default defineComponent({
},
async generateLatLong() {
this.isGeneratingLatLong = true
const postalCode = this.geoPoint.postalCode;
const query = postalCode.startsWith('0') ? `${postalCode} OR ${postalCode.substring(1)}` : postalCode;

const payload = {
json: {
params: {
q: `postcode: ${this.geoPoint.postalCode}`
q: `postcode: ${query}`
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/components/GeoPointPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ export default defineComponent({
emitter.emit('presentLoader')

try {
const postalCode = this.postalAddress.postalCode;
const query = postalCode.startsWith('0') ? `${postalCode} OR ${postalCode.substring(1)}` : postalCode;

resp = await UtilService.generateLatLong({
json: {
params: {
q: `postcode: ${this.postalAddress.postalCode}`
q: `postcode: ${query}`
}
}
})
Expand Down
5 changes: 4 additions & 1 deletion src/views/AddFacilityAddress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,13 @@ export default defineComponent({
if(this.contactNumber) this.saveTelecomNumber()
},
async generateLatLong() {
const postalCode = this.formData.postalCode;
const query = postalCode.startsWith('0') ? `${postalCode} OR ${postalCode.substring(1)}` : postalCode;

const payload = {
json: {
params: {
q: `postcode: ${this.formData.postalCode}`
q: `postcode: ${query}`
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/views/FacilityDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,9 @@ export default defineComponent({
const resp = await UtilService.generateLatLong(payload)

if(!hasError(resp)) {
this.isRegenerationRequired = !(this.postalAddress.postalCode === resp.data.response.docs[0].postcode)
const postalCode = this.postalAddress.postalCode
const fetchedPostcode = resp.data.response.docs[0].postcode
this.isRegenerationRequired = !(postalCode.startsWith('0') ? postalCode.substring(1) === fetchedPostcode || postalCode === fetchedPostcode : postalCode === fetchedPostcode);
} else {
throw resp.data
}
Expand Down
Loading