diff --git a/app/beauty_main.py b/app/beauty_main.py index f00ecf2..93a8a07 100644 --- a/app/beauty_main.py +++ b/app/beauty_main.py @@ -157,14 +157,16 @@ async def enriched( tld: str = Query(None), alpha_only: bool = Query(False), no_sld: bool = Query(False), + assessed: str = Query(None), page: int = Query(1, ge=1), - limit: int = Query(100, ge=1, le=1000), + limit: int = Query(100, ge=1, le=5000), ): total, rows = await get_enriched( min_score=min_score, country=country, prescreen_status=prescreen_status, niche=niche, site_type=site_type, keyword=keyword, tld=tld, alpha_only=alpha_only, no_sld=no_sld, + beauty_assessed=assessed, page=page, limit=limit, ) return {"page": page, "limit": limit, "total": total, "results": rows} diff --git a/app/db.py b/app/db.py index 4e89109..21c63ea 100644 --- a/app/db.py +++ b/app/db.py @@ -337,6 +337,7 @@ async def get_enriched(min_score=0, cms=None, country=None, kit_digital=None, prescreen_status=None, niche=None, site_type=None, keyword=None, tld=None, alpha_only=False, no_sld=False, + beauty_assessed=None, page=1, limit=100): offset = (page - 1) * limit conditions = ["score >= ?"] @@ -379,6 +380,10 @@ async def get_enriched(min_score=0, cms=None, country=None, kit_digital=None, tld_clean = tld.lower().lstrip(".") conditions.append("LOWER(domain) LIKE ?") params.append(f"%.{tld_clean}") + if beauty_assessed == "yes": + conditions.append("beauty_lead_quality IS NOT NULL") + elif beauty_assessed == "no": + conditions.append("beauty_lead_quality IS NULL") if alpha_only: # No hyphens, no digits anywhere in the domain name conditions.append( diff --git a/app/static/beauty/index.html b/app/static/beauty/index.html index 89e760d..1cf42e5 100644 --- a/app/static/beauty/index.html +++ b/app/static/beauty/index.html @@ -145,6 +145,11 @@ textarea{width:100%;resize:vertical;font-family:monospace;font-size:12px} + @@ -152,10 +157,11 @@ textarea{width:100%;resize:vertical;font-family:monospace;font-size:12px} No SLD @@ -443,7 +449,7 @@ function app() { prescreening: false, validating: false, exportQuality: '', exportCountry: '', f: {keyword:'', tld:'', prescreen_status:'live', niche:'beauty_cosmetics', - site_type:'ecommerce', country:'', alpha_only:false, no_sld:false, limit:'100', page:1}, + site_type:'ecommerce', country:'', assessed:'', alpha_only:false, no_sld:false, limit:'100', page:1}, pf: {quality:'', country:'', limit:'100', page:1}, async init() { @@ -493,17 +499,18 @@ function app() { if (this.f.alpha_only) p.set('alpha_only', 'true'); if (this.f.no_sld) p.set('no_sld', 'true'); - // 'none' (Not checked) = domains never in the pipeline → must search DuckDB. - // Any other enrichment filter (live/dead/parked, niche, site_type, country) - // requires the SQLite enriched_domains table. + // 'none' (Not checked) = domains never in the pipeline → DuckDB search. + // Any real status (live/dead/…), niche, site_type, country, or assessed + // requires the SQLite enriched_domains table (all server-side). const hasEnrichFilter = (this.f.prescreen_status && this.f.prescreen_status !== 'none') - || this.f.niche || this.f.site_type || this.f.country; + || this.f.niche || this.f.site_type || this.f.country || this.f.assessed; let endpoint; if (hasEnrichFilter) { if (this.f.prescreen_status) p.set('prescreen_status', this.f.prescreen_status); if (this.f.niche) p.set('niche', this.f.niche); if (this.f.site_type) p.set('site_type', this.f.site_type); if (this.f.country) p.set('country', this.f.country.trim().toUpperCase()); + if (this.f.assessed) p.set('assessed', this.f.assessed); endpoint = '/api/enriched'; } else { endpoint = '/api/domains'; @@ -512,9 +519,21 @@ function app() { const d = await fetch(endpoint + '?' + p).then(r=>r.json()); this.domainsTotal = d.total || 0; let rows = d.results || []; + // 'Not checked': DuckDB returns all domains joined with enriched data; - // filter client-side to keep only those with no prescreen_status yet. + // keep only those with no prescreen_status yet (truly unprocessed). if (this.f.prescreen_status === 'none') rows = rows.filter(r => !r.prescreen_status); + + // Auto-advance: current DuckDB page was fully processed → try next page + // (prevents "0 results" after bulk-validating a page of Not checked domains) + if (rows.length === 0 && this.f.prescreen_status === 'none' + && (d.results||[]).length > 0 && this.f.page < 500) { + this.f.page++; + this.loading = false; + await this.loadDomains(); + return; + } + this.domains = rows; } catch(e) { this.notify('Failed to load: '+e.message, 'error'); } finally { this.loading = false; } @@ -535,7 +554,7 @@ function app() { resetFilters() { this.f = {keyword:'', tld:'', prescreen_status:'live', niche:'beauty_cosmetics', - site_type:'ecommerce', country:'', alpha_only:false, no_sld:false, limit:'100', page:1}; + site_type:'ecommerce', country:'', assessed:'', alpha_only:false, no_sld:false, limit:'100', page:1}; this.selected = []; this.loadDomains(); },