Repository: frappe/frappe
Pull request: fix: console import progress off-by-one
Existing behavior

```
Importing 4 records                 : [==================================================] 125%
```

New behavior
```
Importing (Insert) for doctype Note: 4 records: [========================================] 100%
```
Fixes off-by-one error and adds DocType and import type indicators to message.

closes #24776 

Problem statement:
Console import progress off-by-one
## Description of the issue
Data import utility displays incorrect progress in console mode due to off-by-one error since `frappe.publish_realtime()` takes 1-indexed progress while `update_progress_bar()` takes 0-indexed.


## Steps to reproduce the issue
Import any import file as is intended to be used.
```
frappe.core.doctype.data_import.data_import import import_file

import_file(doctype, file_path, 'insert' or 'update', console=True)
```

### Observed result
```
Importing 4 records                 : [==================================================] 125%
Successfully imported 4 records out of 4
```
### Expected result
```
Importing 4 records                 : [==================================================] 100%
Successfully imported 4 records out of 4
```

Hints from issue discussion:

Commit message: fix: improve progress message

Patch to review:
diff --git a/frappe/core/doctype/data_import/importer.py b/frappe/core/doctype/data_import/importer.py
index c83d60ea8b66..b0e2eeec150a 100644
--- a/frappe/core/doctype/data_import/importer.py
+++ b/frappe/core/doctype/data_import/importer.py
@@ -149,8 +149,8 @@ def import_data(self):
 
 					if self.console:
 						update_progress_bar(
-							f"Importing {total_payload_count} records",
-							current_index,
+							f"Importing ({self.import_type.split()[0]}) for doctype {self.doctype}: {total_payload_count} records",
+							current_index - 1,
 							total_payload_count,
 						)
 					elif total_payload_count > 5:


Code review comments:
diff_hunk: @@ -149,8 +149,8 @@ def import_data(self):
 
 					if self.console:
 						update_progress_bar(
-							f"Importing {total_payload_count} records",
-							current_index,
+							f"Importing ({self.import_type.split()[0]}) for doctype {self.doctype}: {total_payload_count} records",
path: frappe/core/doctype/data_import/importer.py
text: @user1:
```suggestion
							f"Importing {self.doctype}: {total_payload_count} records",
```

This won't be a valid English sentence? 


"importing Insert New Records for doctype" ?


Let's assume user knows what the type is because they just passed it as argument.  

@author:
I had been using it in a script for inserting doctypes that have parent records where one file is imported as an insert, and the next as an update, and having that distinguishing text when importing data for all doctypes was helpful

anyway easy enough to add that to the script instead :) this was my first contribution