fix: property-level scoring for multi-unit properties + multi-unit chip

For properties with explicit sub-units (e.g. prop-001: 280/310/260 m²),
synthetic matching now generates ONE property-level match using the aggregate
areaSqm (850 m²) instead of per-unit matches — ensuring a need for 800-1000 m²
correctly scores the whole floor as +20 (STRONG) rather than -10 each unit.

Pre-market unit-level matches are still generated per released unit so tenants
seeking smaller spaces still see the specific unit signals.

Card shows "X Einheiten · total Y m²" chip when a multi-unit property is matched
at property level (no specific unit assigned).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Sutter
2026-05-21 00:30:03 +02:00
parent e2ec1b1dc9
commit a39c6ed200
2 changed files with 118 additions and 78 deletions
@@ -399,7 +399,7 @@ export function IntelligenceMatchCard({ vm, imageUrl, lat, lng, cityLabel }: Pro
{[vm.locationLabel, vm.availabilityLabel].filter(Boolean).join(' · ')}
</Typography>
{/* Unit context — only shown when a specific named unit is known */}
{/* Specific named unit */}
{vm.preMarketUnit?.unitLabel && (
<Box sx={{ display: 'flex', alignItems: 'center', gap: 0.75, mt: 0.5 }}>
<Chip
@@ -413,6 +413,20 @@ export function IntelligenceMatchCard({ vm, imageUrl, lat, lng, cityLabel }: Pro
</Box>
)}
{/* Multi-unit property: no specific unit matched — show aggregate summary */}
{!vm.preMarketUnit && (vm.preMarketAllUnits?.length ?? 0) > 1 && (
<Box sx={{ display: 'flex', alignItems: 'center', gap: 0.75, mt: 0.5 }}>
<Chip
size="small"
label={`${vm.preMarketAllUnits!.length} Einheiten`}
sx={{ height: 18, fontSize: '0.62rem', bgcolor: '#eff6ff', color: '#1e40af', border: '1px solid #bfdbfe' }}
/>
<Typography variant="caption" sx={{ color: '#64748b', fontSize: '0.68rem' }}>
total {vm.preMarketAllUnits!.reduce((s, u) => s + u.areaSqm, 0).toLocaleString('de-CH')} m²
</Typography>
</Box>
)}
{/* Regular explainability summary */}
{vm.explainabilitySummary && (
<>