feat(connector): [31188f42] Finalize production optimizations, filtering, and dashboard enhancements
This commit is contained in:
60
connector-superoffice/tools/find_missing_whitelist_ids.py
Normal file
60
connector-superoffice/tools/find_missing_whitelist_ids.py
Normal file
@@ -0,0 +1,60 @@
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
|
||||
# Absolute path setup
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
connector_dir = os.path.abspath(os.path.join(current_dir, '..'))
|
||||
sys.path.insert(0, connector_dir)
|
||||
|
||||
from superoffice_client import SuperOfficeClient
|
||||
from config import settings
|
||||
|
||||
def find_missing():
|
||||
print("🔎 Scanning for Associate IDs not in Whitelist...")
|
||||
client = SuperOfficeClient()
|
||||
if not client.access_token:
|
||||
print("❌ Auth failed.")
|
||||
return
|
||||
|
||||
whitelist = settings.ROBOPLANET_WHITELIST
|
||||
|
||||
# Fetch 500 contacts
|
||||
limit = 500
|
||||
endpoint = f"Contact?$orderby=contactId desc&$top={limit}&$select=associateId"
|
||||
|
||||
print(f"📡 Scanning {limit} records...")
|
||||
contacts = client.search(endpoint)
|
||||
|
||||
if contacts:
|
||||
missing_ids = set()
|
||||
match_count = 0
|
||||
for c in contacts:
|
||||
aid = c.get('associateId') or c.get('AssociateId')
|
||||
if aid:
|
||||
is_match = False
|
||||
if str(aid).upper() in whitelist: is_match = True
|
||||
try:
|
||||
if int(aid) in whitelist: is_match = True
|
||||
except: pass
|
||||
|
||||
if is_match:
|
||||
match_count += 1
|
||||
else:
|
||||
missing_ids.add(aid)
|
||||
|
||||
print(f"\n📊 Scan Results ({limit} records):")
|
||||
print(f" - Total Matches (Roboplanet): {match_count}")
|
||||
print(f" - Missing/Other IDs: {len(missing_ids)}")
|
||||
|
||||
if missing_ids:
|
||||
print("\n✅ Found IDs NOT in whitelist:")
|
||||
for mid in sorted(list(missing_ids), key=lambda x: str(x)):
|
||||
print(f" - {mid}")
|
||||
|
||||
print("\n👉 Bitte prüfe, ob eine dieser IDs ebenfalls zu Roboplanet gehört.")
|
||||
else:
|
||||
print("❌ No contacts found.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
find_missing()
|
||||
Reference in New Issue
Block a user