feat(matching): annuity-based fit-out cost in score + fix unapplied DQ/confidence modifiers
Mieterausbau / fit-out economics — surface true total cost of occupancy: - Annuity calc (annuityFactor + effectiveAnnualBurdenPerSqm) replaces straight-line ÷5; FITOUT_ANNUITY_RATE=5% - New hardFacts.fitOutByLandlord: "Wer baut aus?" toggle in NewListing — landlord-borne fit-out is priced into rent (no surcharge), tenant-borne SHELL/BASIC adds annuitized cost minus MAB - scoreBudget now compares effective annual burden (rent + fit-out annuity) vs budget instead of cold rent only; FULL/PREMIUM and landlord-borne unchanged - FitOutCostPanel + CompareTableBody compute annuitized, tenant-aware burden - Central FIT_OUT_LABELS with industry/international vocabulary (Rohbau·Core&Shell, Edelrohbau·CAT A, etc.) - Activate existing generateFitOutAdvice via useFitOutAdvice hook + new FitOutAdvicePanel (MIETERAUSBAU/BKZ/MAB-Amortisation + negotiation tip), shown for tenant-borne SHELL/BASIC - MAB field only asked when tenant builds out (optional) — one new toggle, no extra data burden for property managers Fix: DQ/confidence modifiers were computed but never applied to finalScore (hardcoded 0 in output) — now folded into rawFinal and exposed. Trust-first: weak data quality lowers the score. Resolves 3 pre-existing red tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -20,8 +20,8 @@ import {
|
||||
import { CompareCell, MissingDataCell } from './index'
|
||||
import { RESULT_TYPE_META, DS_COLORS } from '../../lib/ds'
|
||||
import { matchScoreHex } from '../../lib/utils'
|
||||
import { calcFitOutInvestment } from '../../lib/fitOutUtils'
|
||||
import { FITOUT_AMORTIZATION_YEARS } from '../../lib/constants'
|
||||
import { effectiveAnnualBurdenPerSqm } from '../../lib/fitOutUtils'
|
||||
import { FITOUT_AMORTIZATION_YEARS, FITOUT_ANNUITY_RATE, FIT_OUT_LABELS } from '../../lib/constants'
|
||||
import type { UnifiedMatchResult } from '../../domain/unifiedResult'
|
||||
|
||||
// ── Local helper ──────────────────────────────────────────────────────────────
|
||||
@@ -155,11 +155,7 @@ export function CompareTableBody({
|
||||
const prop = getProp(item)
|
||||
if (!prop) return <MissingDataCell reason="Mietpreis nur für bestätigte Objekte verfügbar" />
|
||||
|
||||
const FIT_OUT_LABELS: Record<string, string> = {
|
||||
SHELL: 'Rohbau', BASIC: 'Grundausbau', FULL: 'Vollausbau', PREMIUM: 'Premium-Ausbau',
|
||||
}
|
||||
const READY_TO_MOVE_IN = new Set(['FULL', 'PREMIUM'])
|
||||
|
||||
const fitOutByLandlord = prop.hardFacts?.fitOutByLandlord
|
||||
const monthlyRent = prop.totalRentMonthly
|
||||
?? Math.round(prop.rentPricePerSqm * prop.areaSqm / 12)
|
||||
// ancillaryCosts stored as CHF/m²/Monat
|
||||
@@ -170,21 +166,12 @@ export function CompareTableBody({
|
||||
const fitOutLabel = fitOut ? (FIT_OUT_LABELS[fitOut] ?? fitOut) : null
|
||||
const mabPerSqm = prop.hardFacts?.mieterausbaubeitragPerSqm ?? 0
|
||||
|
||||
// Amortised fit-out monthly cost (mid-range estimate)
|
||||
let fitOutMonthly = 0
|
||||
let fitOutMonthlyLabel: string | null = null
|
||||
if (fitOut && !READY_TO_MOVE_IN.has(fitOut)) {
|
||||
const inv = calcFitOutInvestment(fitOut, prop.areaSqm, mabPerSqm, 0)
|
||||
if (inv && !inv.isFullyCovered) {
|
||||
const months = FITOUT_AMORTIZATION_YEARS * 12
|
||||
const midMin = Math.round(inv.netTotal.min / months)
|
||||
const midMax = Math.round(inv.netTotal.max / months)
|
||||
fitOutMonthly = Math.round((midMin + midMax) / 2)
|
||||
fitOutMonthlyLabel = midMin === midMax
|
||||
? `${midMin.toLocaleString('de-CH')}`
|
||||
: `${midMin.toLocaleString('de-CH')}–${midMax.toLocaleString('de-CH')}`
|
||||
}
|
||||
}
|
||||
// Annuitätischer Ausbau-Aufschlag pro Monat (= 0 bei Vermieter-Übernahme / bezugsfertig)
|
||||
const { fitOutPerSqm } = effectiveAnnualBurdenPerSqm({
|
||||
fitOut, rentPricePerSqm: prop.rentPricePerSqm, mabPerSqm, fitOutByLandlord,
|
||||
})
|
||||
const fitOutMonthly = Math.round(fitOutPerSqm * prop.areaSqm / 12)
|
||||
const fitOutMonthlyLabel = fitOutMonthly > 0 ? fitOutMonthly.toLocaleString('de-CH') : null
|
||||
|
||||
const totalMonthly = monthlyRent
|
||||
+ (monthlyNebenkosten ?? 0)
|
||||
@@ -205,7 +192,7 @@ export function CompareTableBody({
|
||||
)}
|
||||
{fitOutMonthlyLabel && (
|
||||
<Typography variant="caption" color="text.secondary">
|
||||
+ {fitOutMonthlyLabel} CHF/Monat (Ausbau ÷ {FITOUT_AMORTIZATION_YEARS} J.)
|
||||
+ {fitOutMonthlyLabel} CHF/Monat (Ausbau annuit. {FITOUT_AMORTIZATION_YEARS} J. / {Math.round(FITOUT_ANNUITY_RATE * 100)}%)
|
||||
</Typography>
|
||||
)}
|
||||
<Typography variant="body2" sx={{ fontWeight: 700, color: '#152642', borderTop: '1px solid #e2e8f0', pt: 0.5, mt: 0.25 }}>
|
||||
@@ -213,7 +200,7 @@ export function CompareTableBody({
|
||||
</Typography>
|
||||
{fitOutLabel && (
|
||||
<Typography variant="caption" sx={{ color: '#64748b', mt: 0.25 }}>
|
||||
Ausbau: {fitOutLabel}{READY_TO_MOVE_IN.has(fitOut ?? '') ? ' (bezugsfertig)' : ''}
|
||||
Ausbau: {fitOutLabel}{fitOutByLandlord ? ' (im Mietzins)' : fitOutMonthly === 0 ? ' (bezugsfertig)' : ''}
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user