fix
This commit is contained in:
@@ -685,8 +685,21 @@ const (
|
||||
// looked unchanged. Review must compare against these instead.
|
||||
processedOriginalNameSQL = `COALESCE(NULLIF(p.name, ''), NULLIF(r.mapped_data->>'name', ''), NULLIF(r.mapped_data->>'title', ''), '')`
|
||||
processedOriginalDescriptionSQL = `COALESCE(NULLIF(p.description, ''), NULLIF(r.mapped_data->>'description', ''), '')`
|
||||
// Category the feed supplied (before categorize assigned one).
|
||||
processedFeedCategorySQL = `COALESCE(NULLIF(BTRIM(r.mapped_data->>'category'), ''), NULLIF(BTRIM(r.mapped_data->>'category_unique_id'), ''), '')`
|
||||
// Category the feed supplied, before categorize assigned one.
|
||||
//
|
||||
// mapped_data.category is NOT proof of a feed category: the pipeline writes its
|
||||
// own pick back there so the Products UI and reprocess keep it
|
||||
// (processing.persistMappedCategorySQL). Reading it blindly made Review show an
|
||||
// AI-chosen category as the product's Original. category_source records who
|
||||
// chose it — anything other than "mapped" means we determined it, not the feed.
|
||||
// field_sources.category is the second signal and the one that works for rows
|
||||
// processed before category_source existed: it records which step chose the
|
||||
// category on the last run, so an llm/vector pick is never shown as the feed's.
|
||||
processedFeedCategorySQL = `CASE
|
||||
WHEN COALESCE(NULLIF(BTRIM(r.mapped_data->>'category_source'), ''), 'mapped') <> 'mapped' THEN ''
|
||||
WHEN COALESCE(p.field_sources->>'category', '') IN ('llm', 'vector') THEN ''
|
||||
ELSE COALESCE(NULLIF(BTRIM(r.mapped_data->>'category'), ''), NULLIF(BTRIM(r.mapped_data->>'category_unique_id'), ''), '')
|
||||
END`
|
||||
processedHasNameSQL = `(` + processedPreferredNameSQL + ` <> '')`
|
||||
processedHasDescriptionSQL = `(` + processedPreferredDescriptionSQL + ` <> '')`
|
||||
processedHasCategorySQL = `(COALESCE(NULLIF(p.category, ''), '') <> '' AND lower(p.category) <> 'none')`
|
||||
@@ -1284,6 +1297,8 @@ func (s *Service) GetProcessedProduct(ctx context.Context, companyID, id uuid.UU
|
||||
`+processedPreferredDescriptionSQL+` AS description,
|
||||
`+processedOriginalDescriptionSQL+` AS original_description,
|
||||
p.processed_name, p.processed_description,
|
||||
COALESCE(p.meta_title, '') AS meta_title,
|
||||
COALESCE(p.meta_description, '') AS meta_description,
|
||||
p.status, p.attributes, p.processed_attributes, r.gtin, r.mapped_data,
|
||||
COALESCE(p.feed_id, r.feed_id) AS feed_id,
|
||||
f.name AS feed_name,
|
||||
@@ -1304,6 +1319,7 @@ func (s *Service) GetProcessedProduct(ctx context.Context, companyID, id uuid.UU
|
||||
"id", "product_id", "name", "original_name", "category", "category_name", "category_unique_id",
|
||||
"feed_category",
|
||||
"description", "original_description", "processed_name", "processed_description",
|
||||
"meta_title", "meta_description",
|
||||
"status", "attributes", "processed_attributes", "gtin", "mapped_data",
|
||||
"feed_id", "feed_name", "feed_last_synced_at", "raw_updated_at",
|
||||
"has_processed_name", "has_processed_description", "has_attributes", "has_processed_attributes",
|
||||
|
||||
Reference in New Issue
Block a user