From 8cb6f21581ae4bf0ff890fadda5ede02c7b9e84c Mon Sep 17 00:00:00 2001 From: Benjamin Sutter Date: Sun, 21 Jun 2026 00:51:16 +0200 Subject: [PATCH] fix(matching): exclude external scraped listings from demand results MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/services/matchSyncService.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/services/matchSyncService.ts b/src/services/matchSyncService.ts index ae02cf1..619d0ed 100644 --- a/src/services/matchSyncService.ts +++ b/src/services/matchSyncService.ts @@ -87,12 +87,23 @@ function scoreProperty( 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. */ export function generateMatchesForNeed(need: Need): void { const now = new Date().toISOString() const MIN_SCORE = 22 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 if (hasExplicitUnits) {