@zeniai/client-epic-state 4.19.99-betaRD2 → 4.19.99-betaRD3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +1 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +12 -0
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +12 -0
- package/lib/esm/view/aiAccountantView/aiAccountantViewSelector.js +1 -12
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/aiAccountantView/aiAccountantViewSelector.js +1 -12
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ function getAiAccountantJobsByTenantId(customerState, userState, tenantId) {
|
|
|
14
14
|
// ── Helpers ──
|
|
15
15
|
function toCustomerView(customer, userState) {
|
|
16
16
|
return {
|
|
17
|
+
averageAccuracy: calcAverageAccuracy(customer),
|
|
17
18
|
companyId: customer.companyId,
|
|
18
19
|
companyName: customer.companyName,
|
|
19
20
|
tenantId: customer.tenantId,
|
|
@@ -52,3 +53,14 @@ function toJobView(job, userState) {
|
|
|
52
53
|
validationResults: job.validationResults,
|
|
53
54
|
};
|
|
54
55
|
}
|
|
56
|
+
function calcAverageAccuracy(customer) {
|
|
57
|
+
const accuracy = customer.enrollment?.accuracy;
|
|
58
|
+
if (accuracy == null) {
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
|
61
|
+
const values = Object.values(accuracy);
|
|
62
|
+
if (values.length === 0) {
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
return values.reduce((sum, value) => sum + value, 0) / values.length;
|
|
66
|
+
}
|
|
@@ -10,6 +10,7 @@ export function getAiAccountantJobsByTenantId(customerState, userState, tenantId
|
|
|
10
10
|
// ── Helpers ──
|
|
11
11
|
function toCustomerView(customer, userState) {
|
|
12
12
|
return {
|
|
13
|
+
averageAccuracy: calcAverageAccuracy(customer),
|
|
13
14
|
companyId: customer.companyId,
|
|
14
15
|
companyName: customer.companyName,
|
|
15
16
|
tenantId: customer.tenantId,
|
|
@@ -48,3 +49,14 @@ function toJobView(job, userState) {
|
|
|
48
49
|
validationResults: job.validationResults,
|
|
49
50
|
};
|
|
50
51
|
}
|
|
52
|
+
function calcAverageAccuracy(customer) {
|
|
53
|
+
const accuracy = customer.enrollment?.accuracy;
|
|
54
|
+
if (accuracy == null) {
|
|
55
|
+
return 0;
|
|
56
|
+
}
|
|
57
|
+
const values = Object.values(accuracy);
|
|
58
|
+
if (values.length === 0) {
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
|
61
|
+
return values.reduce((sum, value) => sum + value, 0) / values.length;
|
|
62
|
+
}
|
|
@@ -53,20 +53,9 @@ const getSortedCustomers = (customers, sortKey, sortOrder) => {
|
|
|
53
53
|
case 'latestSync':
|
|
54
54
|
return customer.enrollment?.latestTransactionSync ?? '';
|
|
55
55
|
case 'accuracy':
|
|
56
|
-
return
|
|
56
|
+
return customer.averageAccuracy;
|
|
57
57
|
default:
|
|
58
58
|
return customer.companyName.toLowerCase();
|
|
59
59
|
}
|
|
60
60
|
}, direction);
|
|
61
61
|
};
|
|
62
|
-
const calcCustomerAccuracy = (customer) => {
|
|
63
|
-
const accuracy = customer.enrollment?.accuracy;
|
|
64
|
-
if (accuracy == null) {
|
|
65
|
-
return 0;
|
|
66
|
-
}
|
|
67
|
-
const values = Object.values(accuracy);
|
|
68
|
-
if (values.length === 0) {
|
|
69
|
-
return 0;
|
|
70
|
-
}
|
|
71
|
-
return values.reduce((sum, value) => sum + value, 0) / values.length;
|
|
72
|
-
};
|