diff --git a/app/system/backend/sync_router.py b/app/system/backend/sync_router.py index 095dd55..5c03941 100644 --- a/app/system/backend/sync_router.py +++ b/app/system/backend/sync_router.py @@ -202,6 +202,7 @@ async def sync_vtiger_contacts() -> Dict[str, Any]: updated_count = 0 skipped_count = 0 linked_count = 0 + debug_counter = 0 # Track how many we've logged for contact in contacts: vtiger_contact_id = contact.get('id') @@ -284,9 +285,10 @@ async def sync_vtiger_contacts() -> Dict[str, Any]: # Link contact to customer if account_id exists account_id = contact.get('account_id') - # Debug: Log first 10 contacts with account_id info - if len(contacts) < 20: # Only log for small batches or first few - logger.info(f"🔍 Debug kontakt: {first_name} {last_name}, account_id={account_id}, contact_id={contact_id if 'contact_id' in locals() else 'N/A'}") + # Debug: Log first 20 contacts with account_id info + if debug_counter < 20: + logger.info(f"🔍 Debug kontakt #{debug_counter+1}: {first_name} {last_name}, account_id='{account_id}', contact_id={contact_id if 'contact_id' in locals() else 'N/A'}") + debug_counter += 1 if account_id and contact_id: # Find customer by vTiger account ID