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

@@ -1133,7 +1133,7 @@ def run_auto_import_for_upload(db: Session, uploaded_items: List[Dict[str, Any]]
import_log.completed_at = datetime.now()
db.commit()
files_summary.append({
summary_item = {
"filename": item.get("filename"),
"stored_filename": stored_filename,
"import_type": import_type,
@@ -1142,7 +1142,18 @@ def run_auto_import_for_upload(db: Session, uploaded_items: List[Dict[str, Any]]
"success_count": result.get("success", 0),
"error_count": len(result.get("errors", [])),
"errors": (result.get("errors", [])[:10] if result.get("errors") else []),
})
}
# Add skip details if present (for phone imports and others that track this)
if result.get("skipped_no_phone", 0) > 0 or result.get("skipped_no_id", 0) > 0:
skip_details = []
if result.get("skipped_no_phone", 0) > 0:
skip_details.append(f"{result['skipped_no_phone']} rows without phone number")
if result.get("skipped_no_id", 0) > 0:
skip_details.append(f"{result['skipped_no_id']} rows without ID")
summary_item["skip_info"] = ", ".join(skip_details)
files_summary.append(summary_item)
if result.get("errors"):
stopped = True