This commit is contained in:
greeneclipse committed 2026-10-16 00:55:28 +02:00
1 parent 1e7c7bbfbb
commit feebf7d3c1
12 files changed
+248 -70

No files matched your search

+17 -3
View File
@@ -700,9 +700,9 @@ const (
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')`
processedHasNameSQL = `(` + processedPreferredNameSQL + ` <> '')`
processedHasDescriptionSQL = `(` + processedPreferredDescriptionSQL + ` <> '')`
processedHasCategorySQL = `(COALESCE(NULLIF(p.category, ''), '') <> '' AND lower(p.category) <> 'none')`
// Resolve display name / canonical unique_id when products store unique_id, UUID id, or name.
processedCategoryResolveJoin = `
LEFT JOIN LATERAL (
@@ -1071,6 +1071,20 @@ func appendProcessedProductFilters(f ProductFilter, args []any, where []string)
n, n, n, n, n))
}
if f.Status != "" {
// The dashboard's Processed tab must also surface already-generated legacy
// API results. Pre-v16 jobs were not tagged with their origin, so we cannot
// safely approve them in a migration. Include only rows with actual generated
// fields, preserving their original needs_review status and actions.
if f.Status == "generated" {
where = append(where, `(p.status = 'completed' OR
(p.status IN ('needs_review', 'processed') AND (
NULLIF(BTRIM(COALESCE(p.processed_name, '')), '') IS NOT NULL OR
NULLIF(BTRIM(COALESCE(p.processed_description, '')), '') IS NOT NULL OR
NULLIF(BTRIM(COALESCE(p.meta_title, '')), '') IS NOT NULL OR
NULLIF(BTRIM(COALESCE(p.meta_description, '')), '') IS NOT NULL
)))`)
return args, where
}
// needs_review includes legacy pipeline status "processed" (pre-P0-8).
if f.Status == "needs_review" {
where = append(where, "p.status IN ('needs_review', 'processed')")