fix(matching): exclude external scraped listings from demand results

External third-party scrapes (Homegate/ImmoScout/newhome/MatchOffice) were mis-tagged as VERIFIED_PORTFOLIO in mock data and surfaced as "own platform" matches. Skip them in match generation — demand results now only contain genuine platform objects, Maison Work, and Future Availability.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Benjamin Sutter
2026-06-21 00:51:16 +02:00
parent 29be4f6e54
commit 8cb6f21581
+11
View File
@@ -87,12 +87,23 @@ function scoreProperty(
return calculateScore(need, prop) return calculateScore(need, prop)
} }
// Externe Inserate aus Drittquellen (Scrapes) sind keine Plattform-Inventar-Objekte und
// gehören nicht in die Treffer (nur eigene Plattform-Objekte, Maison Work, Future Availability).
const EXTERNAL_SCRAPE_SOURCES = new Set(['HOMEGATE_SCRAPE', 'IMMOSCOUT_SCRAPE', 'NEWHOME_SCRAPE', 'MATCHOFFICE_SCRAPE'])
function isExternalListing(prop: Property): boolean {
return prop.resultType === ResultType.VERIFIED_PORTFOLIO
&& !!prop.sourceType && EXTERNAL_SCRAPE_SOURCES.has(prop.sourceType)
}
/** Generate matches for a single need against all properties and push them into matchStore. */ /** Generate matches for a single need against all properties and push them into matchStore. */
export function generateMatchesForNeed(need: Need): void { export function generateMatchesForNeed(need: Need): void {
const now = new Date().toISOString() const now = new Date().toISOString()
const MIN_SCORE = 22 const MIN_SCORE = 22
for (const prop of propertyStore) { for (const prop of propertyStore) {
// Externe Scrape-Inserate, die fälschlich als Plattform-Objekt getaggt sind → nicht matchen
if (isExternalListing(prop)) continue
const hasExplicitUnits = (prop.units ?? []).length > 0 const hasExplicitUnits = (prop.units ?? []).length > 0
if (hasExplicitUnits) { if (hasExplicitUnits) {