Add detailed skip tracking for phone imports

- Track skipped_no_phone and skipped_no_id separately
- Display skip information in admin UI with warning icon
- Clarify that empty phone numbers cannot be imported (PK constraint)
- Update documentation to explain expected skip behavior
- Example: 143 rows without phone numbers is correct, not an error

When importing PHONE.csv with empty phone numbers:
- Rows are properly skipped (cannot have NULL in primary key)
- User sees: '⚠️ Skipped: 143 rows without phone number'
- This is expected behavior, not a bug
This commit is contained in:
HotSwapp
2025-10-13 08:46:53 -05:00
parent 63809d46fb
commit ac98bded69
6 changed files with 26474 additions and 4 deletions

View File

@@ -773,7 +773,7 @@ def import_rolodex(db: Session, file_path: str) -> Dict[str, Any]:
def import_phone(db: Session, file_path: str) -> Dict[str, Any]:
"""Import PHONE.csv → LegacyPhone model with upsert logic."""
result = {'success': 0, 'errors': [], 'total_rows': 0, 'updated': 0, 'inserted': 0, 'skipped': 0}
result = {'success': 0, 'errors': [], 'total_rows': 0, 'updated': 0, 'inserted': 0, 'skipped': 0, 'skipped_no_phone': 0, 'skipped_no_id': 0}
try:
f, encoding = open_text_with_fallbacks(file_path)
@@ -789,7 +789,12 @@ def import_phone(db: Session, file_path: str) -> Dict[str, Any]:
rolodex_id = clean_string(row.get('Id'))
phone = clean_string(row.get('Phone'))
if not rolodex_id or not phone:
# Skip rows with missing required fields (phone is part of PK, cannot be NULL)
if not rolodex_id:
result['skipped_no_id'] += 1
continue
if not phone:
result['skipped_no_phone'] += 1
continue
# Create a composite key for tracking