From 19c31876b200171d0e13e32b1f00a58889c0b5eb Mon Sep 17 00:00:00 2001 From: Maciej Pienczyn Date: Sat, 21 Feb 2026 10:29:43 +0100 Subject: [PATCH] feat: show rejected domains per company in discovery dashboard Co-Authored-By: Claude Opus 4.6 --- blueprints/admin/routes_data_quality.py | 15 ++++++++++++ templates/admin/data_quality_dashboard.html | 26 ++++++++++++++------- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/blueprints/admin/routes_data_quality.py b/blueprints/admin/routes_data_quality.py index aba3691..c1de3ff 100644 --- a/blueprints/admin/routes_data_quality.py +++ b/blueprints/admin/routes_data_quality.py @@ -273,6 +273,20 @@ def admin_data_quality(): ).distinct().all() ) only_rejected_ids = rejected_company_ids - active_candidate_ids + + # Fetch rejected domains per company + rejected_candidates = db.query( + WebsiteDiscoveryCandidate.company_id, + WebsiteDiscoveryCandidate.candidate_domain, + ).filter( + WebsiteDiscoveryCandidate.status == 'rejected', + WebsiteDiscoveryCandidate.company_id.in_(only_rejected_ids) if only_rejected_ids else False, + ).all() + rejected_domains_map = {} + for cid, domain in rejected_candidates: + if domain: + rejected_domains_map.setdefault(cid, set()).add(domain) + rejected_companies = [] for cid in only_rejected_ids: comp = company_map.get(cid) @@ -280,6 +294,7 @@ def admin_data_quality(): rejected_companies.append({ 'company_name': comp.name, 'company_id': cid, + 'domains': sorted(rejected_domains_map.get(cid, set())), }) rejected_companies.sort(key=lambda x: x['company_name']) diff --git a/templates/admin/data_quality_dashboard.html b/templates/admin/data_quality_dashboard.html index 7273648..1dbb6b3 100644 --- a/templates/admin/data_quality_dashboard.html +++ b/templates/admin/data_quality_dashboard.html @@ -753,15 +753,23 @@ {% if rejected_companies %}
- - Odrzucone przez admina ({{ rejected_companies|length }}): - - - {% for rc in rejected_companies %}{{ rc.company_name }}{% if not loop.last %}, {% endif %}{% endfor %} - - - Te firmy nie będą ponownie wyszukiwane w trybie zbiorczym. - +
+ Odrzucone przez admina ({{ rejected_companies|length }} firm): +
+
+ {% for rc in rejected_companies %} +
+ {{ rc.company_name }} + {% if rc.domains %} + + {{ rc.domains|join(', ') }} + {% endif %} +
+ {% endfor %} +
+
+ Odrzucone domeny nie pojawią się ponownie w propozycjach. +
{% endif %}