fix
This commit is contained in:
@@ -1522,6 +1522,9 @@ func (p *Pipeline) processOne(ctx context.Context, companyID, jobID uuid.UUID, i
|
||||
CategoryNamesByUID: categoryNamesByUID,
|
||||
AllowedAttrKeys: allowedAttrKeysForCategory(cache, stringFromAny(enriched["category"])),
|
||||
CategoryAttrKeys: categoryAttrKeysFromCache(cache),
|
||||
JobID: jobID.String(),
|
||||
CompanyID: companyID.String(),
|
||||
RawProductID: it.RawID.String(),
|
||||
}
|
||||
if it.hydrated {
|
||||
if it.hasPrior {
|
||||
@@ -1577,6 +1580,8 @@ func (p *Pipeline) processOne(ctx context.Context, companyID, jobID uuid.UUID, i
|
||||
jobID, it.RawID, catPreFilter)
|
||||
}
|
||||
syncCategoryName(&result, cache.categoryNamesByUID)
|
||||
scrubCategoryPollution(&result, cache.categoryNamesByUID, cache.categoryUniqueIDs)
|
||||
syncCategoryName(&result, cache.categoryNamesByUID)
|
||||
}
|
||||
// Re-apply after category validation so allowlist matches the persisted category.
|
||||
allowed := allowedAttrKeysForCategory(cache, result.Category)
|
||||
@@ -1676,7 +1681,10 @@ const upsertProcessedProductSQL = `
|
||||
ON CONFLICT (company_id, raw_product_id) DO UPDATE SET
|
||||
product_id = EXCLUDED.product_id,
|
||||
name = EXCLUDED.name,
|
||||
category = COALESCE(NULLIF(BTRIM(EXCLUDED.category), ''), processed_products.category),
|
||||
category = CASE
|
||||
WHEN COALESCE(EXCLUDED.field_sources->>'category', '') = 'cleared_invalid' THEN ''
|
||||
ELSE COALESCE(NULLIF(BTRIM(EXCLUDED.category), ''), processed_products.category)
|
||||
END,
|
||||
description = EXCLUDED.description,
|
||||
processed_name = EXCLUDED.processed_name,
|
||||
processed_description = EXCLUDED.processed_description,
|
||||
|
||||
Reference in New Issue
Block a user