feat: Add 'Single Locs With Unmatched Biz Names' filter button and corresponding functionality
This commit is contained in:
parent
d9a7b58c94
commit
3007d3e49f
|
|
@ -164,6 +164,7 @@
|
|||
<a href="?duplicate_phone=true" class="btn btn-secondary">Duplicate Phone</a>
|
||||
<a href="?single_loc_businesses=true" class="btn btn-secondary">Single Loc Businesses</a>
|
||||
<a href="?duplicate_business_uuid=true" class="btn btn-secondary">Multi Loc Businesses</a>
|
||||
<a href="?single_locs_unmatched_biz_names=true" class="btn btn-secondary">Single Locs With Unmatched Biz Names</a>
|
||||
</div>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ def ids_data(request):
|
|||
duplicate_location_uuid = request.GET.get('duplicate_location_uuid')
|
||||
duplicate_phone = request.GET.get('duplicate_phone')
|
||||
single_loc_businesses = request.GET.get('single_loc_businesses')
|
||||
single_locs_unmatched_biz_names = request.GET.get('single_locs_unmatched_biz_names')
|
||||
columns = request.GET.get('columns', 'gbp_business_category,gbp_location_municipality,gbp_location_state').split(',')
|
||||
ids_data_list = IDSData.objects.all().order_by('business_name')
|
||||
if categories:
|
||||
|
|
@ -96,6 +97,9 @@ def ids_data(request):
|
|||
ids_data_list = ids_data_list.filter(gbp_business_phone__in=IDSData.objects.values('gbp_business_phone').annotate(count=Count('gbp_business_phone')).filter(count__gt=1).values('gbp_business_phone'))
|
||||
if single_loc_businesses:
|
||||
ids_data_list = ids_data_list.exclude(business_uuid__in=IDSData.objects.values('business_uuid').annotate(count=Count('business_uuid')).filter(count__gt=1).values('business_uuid'))
|
||||
if single_locs_unmatched_biz_names:
|
||||
multi_loc_business_uuids = IDSData.objects.values('business_uuid').annotate(count=Count('business_uuid')).filter(count__gt=1).values('business_uuid')
|
||||
ids_data_list = ids_data_list.filter(business_uuid__in=multi_loc_business_uuids).exclude(business_name=F('business_uuid__idsdata__business_name'))
|
||||
paginator = Paginator(ids_data_list, 50) # Show 50 items per page
|
||||
page_number = request.GET.get('page')
|
||||
page_obj = paginator.get_page(page_number)
|
||||
|
|
|
|||
Loading…
Reference in a new issue