Fix import status logic bug
The import_log.status was incorrectly set to 'failed' when there were NO errors. The condition 'if result["errors"]' evaluates to False when errors list is empty, causing the logic to be inverted. Fixed: 'completed' if not result['errors'] else 'failed' This caused successful imports with 0 errors to show as 'Failed' in the UI.
This commit is contained in:
@@ -1961,7 +1961,7 @@ async def admin_import_data(
|
||||
result = process_csv_import(db, data_type, file_path)
|
||||
|
||||
# Update import log
|
||||
import_log.status = "completed" if result['errors'] else "failed"
|
||||
import_log.status = "completed" if not result['errors'] else "failed"
|
||||
import_log.total_rows = result['total_rows']
|
||||
import_log.success_count = result['success']
|
||||
import_log.error_count = len(result['errors'])
|
||||
|
||||
Reference in New Issue
Block a user