fix: beauty frontend server-side filtering and bulk actions
- add keyword and tld params to get_enriched() in db.py (LIKE on domain + page_title) - forward keyword/tld through /api/enriched in beauty_main.py - rewrite beauty/index.html loadDomains() to pass all filters server-side via URLSearchParams - track domainsTotal from API response for correct pagination display - add Pre-screen Selected and B2B Assess Selected bulk action buttons - add per-row Screen and Assess buttons - goSearch() resets to page 1 before fetching Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
11
app/db.py
11
app/db.py
@@ -334,6 +334,7 @@ async def get_stats():
|
||||
async def get_enriched(min_score=0, cms=None, country=None, kit_digital=None,
|
||||
ai_only=False, lead_quality=None,
|
||||
prescreen_status=None, niche=None, site_type=None,
|
||||
keyword=None, tld=None,
|
||||
page=1, limit=100):
|
||||
offset = (page - 1) * limit
|
||||
conditions = ["score >= ?"]
|
||||
@@ -343,7 +344,7 @@ async def get_enriched(min_score=0, cms=None, country=None, kit_digital=None,
|
||||
params.append(cms)
|
||||
if country:
|
||||
conditions.append("ip_country = ?")
|
||||
params.append(country)
|
||||
params.append(country.upper())
|
||||
if kit_digital is not None:
|
||||
conditions.append("kit_digital = ?")
|
||||
params.append(1 if kit_digital else 0)
|
||||
@@ -363,6 +364,14 @@ async def get_enriched(min_score=0, cms=None, country=None, kit_digital=None,
|
||||
if site_type:
|
||||
conditions.append("site_type = ?")
|
||||
params.append(site_type)
|
||||
if keyword:
|
||||
kw = f"%{keyword.lower()}%"
|
||||
conditions.append("(LOWER(domain) LIKE ? OR LOWER(COALESCE(page_title,'')) LIKE ?)")
|
||||
params.extend([kw, kw])
|
||||
if tld:
|
||||
tld_clean = tld.lower().lstrip(".")
|
||||
conditions.append("LOWER(domain) LIKE ?")
|
||||
params.append(f"%.{tld_clean}")
|
||||
where = "WHERE " + " AND ".join(conditions)
|
||||
async with aiosqlite.connect(SQLITE_PATH, timeout=30) as db:
|
||||
db.row_factory = aiosqlite.Row
|
||||
|
||||
Reference in New Issue
Block a user