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) {