Skip to content

Commit

Permalink
Merge pull request #14 from Bowery-RES/bug/web-4375-fix-chrome-extens…
Browse files Browse the repository at this point in the history
…ion-for-compass

[WEB-4375] Fix UnitNumber for compass.com
  • Loading branch information
igor-kazakevich authored Feb 16, 2022
2 parents 90aafee + b6a08a7 commit ea10f41
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bowery-chrome-extension",
"version": "2.2.7",
"version": "2.3.1",
"description": "Chrome extension for Bowery appraisers using the Bowery Authorship Application.",
"scripts": {
"build": "node scripts/build.js",
Expand Down
2 changes: 1 addition & 1 deletion src/entities/UnitCompDTOTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ export default {
sqft: Number,
bathrooms: Number,
rent: Number,
unitNumber: Number,
unitNumber: String,
}
12 changes: 5 additions & 7 deletions src/parsers/CompassParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ export default class CompassParser {
this.source = SOURCES_MAP[this.document.location.hostname]
}

get location() {
get address() {
const prettyAddress = get(this.compData, 'props.listingRelation.listing.location.prettyAddress', '')
const locations = prettyAddress.split(/,\s+/)

if (locations.length < 2) {
return locations
return locations[0]
}

const unitNumber = locations.pop()
const address = locations.join(', ')
return [address, unitNumber]
return locations.slice(0, -1).join(', ')
}

get unitLayout() {
Expand Down Expand Up @@ -57,8 +55,8 @@ export default class CompassParser {
sqft: get(this.compData, 'props.listingRelation.listing.size.squareFeet', 0),
bathrooms: get(this.compData, 'props.listingRelation.listing.size.totalBathrooms', 0),
rent: get(this.compData, 'props.listingRelation.listing.price.lastKnown', null),
address: isEmpty(this.location[0]) ? null : this.location[0],
unitNumber: isEmpty(this.location[1]) ? null : this.location[1],
address: isEmpty(this.address) ? null : this.address,
unitNumber: get(this.compData, 'props.listingRelation.listing.location.unitNumber', null),
unitLayout: this.unitLayout,
dateOfValue: this.dateOfValue,
sourceOfInformation: 'externalDatabase',
Expand Down

0 comments on commit ea10f41

Please sign in to comment.