Drop useless "already in system" counter on AMAS done screen
During setup the Employee table is always empty, so the breakdown was always "new: N, already in system: 0" — noise without signal. Removed the counter and the get_list round-trip that fed it. The import step still updates existing rows on FIN match if any ever appear.
This commit is contained in:
parent
cab4131803
commit
e401eb1210
|
|
@ -1 +1 @@
|
||||||
__version__ = "0.1.0"
|
__version__ = "0.1.1"
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ frappe.provide("jey_wizard");
|
||||||
// Bump this string in every commit that changes wizard code. Displayed in the badge so
|
// Bump this string in every commit that changes wizard code. Displayed in the badge so
|
||||||
// we can tell at a glance which version is actually running on a given machine. Kept in
|
// we can tell at a glance which version is actually running on a given machine. Kept in
|
||||||
// sync with __version__ in jey_wizard/__init__.py.
|
// sync with __version__ in jey_wizard/__init__.py.
|
||||||
const JEY_WIZARD_VERSION = "0.1.0";
|
const JEY_WIZARD_VERSION = "0.1.1";
|
||||||
|
|
||||||
// Wipe Frappe + ERPNext default slides so their `before_load`/`after_load` listeners
|
// Wipe Frappe + ERPNext default slides so their `before_load`/`after_load` listeners
|
||||||
// don't try to mutate a wizard that isn't slide-based anymore.
|
// don't try to mutate a wizard that isn't slide-based anymore.
|
||||||
|
|
@ -368,14 +368,11 @@ frappe.setup.SetupWizard = class JeySetupWizard {
|
||||||
`);
|
`);
|
||||||
} else if (this.amas_state === "done") {
|
} else if (this.amas_state === "done") {
|
||||||
const n = (this.data.amas_selected_employees || []).length;
|
const n = (this.data.amas_selected_employees || []).length;
|
||||||
const existingCount = Object.keys(this.amas_existing_map || {}).length;
|
|
||||||
const newCount = n - existingCount;
|
|
||||||
$body.html(`
|
$body.html(`
|
||||||
<h3 style="margin-bottom:16px;color:#080">✓ ${__("Employees ready to import")}</h3>
|
<h3 style="margin-bottom:16px;color:#080">✓ ${__("Employees ready to import")}</h3>
|
||||||
<div style="padding:12px;background:#e8f5e9;border-radius:4px;margin-bottom:12px">
|
<div style="padding:12px;background:#e8f5e9;border-radius:4px;margin-bottom:12px">
|
||||||
${__("Organization:")} <b>${frappe.utils.escape_html(this.data.amas_organization_name || "")}</b><br>
|
${__("Organization:")} <b>${frappe.utils.escape_html(this.data.amas_organization_name || "")}</b><br>
|
||||||
${__("Employees found:")} <b>${n}</b>
|
${__("Employees found:")} <b>${n}</b>
|
||||||
(${__("new")}: <b>${newCount < 0 ? n : newCount}</b>, ${__("already in system")}: <b>${existingCount}</b>)
|
|
||||||
</div>
|
</div>
|
||||||
<p style="color:#666">${__("All employees will be imported into ƏMAS Employees and the standard Employee doctype after the wizard finishes.")}</p>
|
<p style="color:#666">${__("All employees will be imported into ƏMAS Employees and the standard Employee doctype after the wizard finishes.")}</p>
|
||||||
`);
|
`);
|
||||||
|
|
@ -993,37 +990,7 @@ frappe.setup.SetupWizard = class JeySetupWizard {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.amas_employees = employees;
|
this.amas_employees = employees;
|
||||||
// Populate existing_map purely for the summary UI; the actual import
|
this.amas_commit_selection();
|
||||||
// updates existing records rather than skipping them, so no filtering.
|
|
||||||
const fins = employees
|
|
||||||
.map((e) => e.identification_number)
|
|
||||||
.filter(Boolean);
|
|
||||||
if (fins.length === 0) {
|
|
||||||
this.amas_existing_map = {};
|
|
||||||
this.amas_commit_selection();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
frappe.call({
|
|
||||||
method: "frappe.client.get_list",
|
|
||||||
args: {
|
|
||||||
doctype: "Employee",
|
|
||||||
filters: { passport_number: ["in", fins] },
|
|
||||||
fields: ["name", "passport_number"],
|
|
||||||
limit_page_length: 0,
|
|
||||||
},
|
|
||||||
callback: (r2) => {
|
|
||||||
const map = {};
|
|
||||||
(r2.message || []).forEach((emp) => {
|
|
||||||
if (emp.passport_number) map[emp.passport_number] = emp.name;
|
|
||||||
});
|
|
||||||
this.amas_existing_map = map;
|
|
||||||
this.amas_commit_selection();
|
|
||||||
},
|
|
||||||
error: () => {
|
|
||||||
this.amas_existing_map = {};
|
|
||||||
this.amas_commit_selection();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue