Skip to content

Commit

Permalink
hotfix: check if general summary exists, otherwise use reserved (#1599)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyjablonski authored Feb 25, 2022
1 parent edd1152 commit 513a733
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/javascript/pages/RentDirectory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ import {
eligibilityHeader,
} from "./ListingDirectory/DirectoryHelpers"

const getForRentSummaryTable = (listing: RailsRentalListing) =>
listing.unitSummaries.general
const getForRentSummaryTable = (listing: RailsRentalListing) => {
const summary = listing.unitSummaries.general ?? listing.unitSummaries.reserved
if (!summary) return null

return summary
.filter((summary) => !!summary.unitType)
.map((summary) => ({
unitType: {
Expand All @@ -55,6 +58,7 @@ const getForRentSummaryTable = (listing: RailsRentalListing) =>
},
colFour: { cellText: getRentRangeString(summary), cellSubText: getRentSubText(summary) },
}))
}

const getRentalHeader = (
filters: EligibilityFilters,
Expand Down

0 comments on commit 513a733

Please sign in to comment.