Files
property-match/src/provider/MockupMatchProvider.ts
T
Benjamin Sutter 27c53f3af1 feat: score transparency on all cards + budget parser fix
- Single scoring system: MockupNeedProvider rewrites matches via calculateScore
  exclusively — allFactors always populated, no more dual-system (computeScore
  removed), weights from weightingProfile reflected in every breakdown
- ScoreInlineBreakdown: new component shows hard/soft criteria with importance
  labels (Entscheidend/Sehr wichtig/…) and formula on compact + expanded cards
- MatchCardAdapter: passes scoreBreakdown + allFactors to ViewModel
- MatchDetail: 'Zukunftssignal' label replaced with 'Future Availability'
- aiService budget parser: values < 100 treated as monthly and multiplied by 12
  to produce correct annual CHF/m²/year value — fixes 0-result searches

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 20:41:46 +02:00

33 lines
1.5 KiB
TypeScript

import type { IMatchProvider, MatchFilters } from './IMatchProvider'
import type { Match } from '../domain/match'
// Matches are computed dynamically via calculateScore so weights always reflect need.weightingProfile
export const matchStore: Match[] = []
const store = matchStore
export const MockupMatchProvider: IMatchProvider = {
async getAll(filters?: MatchFilters) {
let results = [...store]
if (filters?.needId) results = results.filter(m => m.needId === filters.needId)
if (filters?.propertyId) results = results.filter(m => m.propertyId === filters.propertyId)
if (filters?.minScore) results = results.filter(m => m.matchScore >= filters.minScore!)
if (filters?.matchStrength) results = results.filter(m => m.matchStrength === filters.matchStrength)
if (filters?.organizationId) results = results.filter(m => m.organizationId === filters.organizationId)
return results.sort((a, b) => b.matchScore - a.matchScore)
},
async getById(id) {
return store.find(m => m.id === id) ?? null
},
async getByNeed(needId) {
return store.filter(m => m.needId === needId).sort((a, b) => b.matchScore - a.matchScore)
},
async getByProperty(propertyId) {
return store.filter(m => m.propertyId === propertyId).sort((a, b) => b.matchScore - a.matchScore)
},
async approve(id, reviewedBy) {
const idx = store.findIndex(m => m.id === id)
store[idx] = { ...store[idx], isApproved: true, reviewedBy, reviewedAt: new Date().toISOString(), updatedAt: new Date().toISOString() }
return store[idx]
},
}