tango-app-api-audit 3.5.42 → 3.5.44
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/README.md
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
# README #
|
|
2
|
-
|
|
3
|
-
This README would normally document whatever steps are necessary to get your application up and running.
|
|
4
|
-
|
|
5
|
-
### What is this repository for? ###
|
|
6
|
-
|
|
7
|
-
* Quick summary
|
|
8
|
-
* Version
|
|
9
|
-
* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
|
|
10
|
-
|
|
11
|
-
### How do I get set up? ###
|
|
12
|
-
|
|
13
|
-
* Summary of set up
|
|
14
|
-
* Configuration
|
|
15
|
-
* Dependencies
|
|
16
|
-
* Database configuration
|
|
17
|
-
* How to run tests
|
|
18
|
-
* Deployment instructions
|
|
19
|
-
|
|
20
|
-
### Contribution guidelines ###
|
|
21
|
-
|
|
22
|
-
* Writing tests
|
|
23
|
-
* Code review
|
|
24
|
-
* Other guidelines
|
|
25
|
-
|
|
26
|
-
### Who do I talk to? ###
|
|
27
|
-
|
|
28
|
-
* Repo owner or admin
|
|
1
|
+
# README #
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get your application up and running.
|
|
4
|
+
|
|
5
|
+
### What is this repository for? ###
|
|
6
|
+
|
|
7
|
+
* Quick summary
|
|
8
|
+
* Version
|
|
9
|
+
* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
|
|
10
|
+
|
|
11
|
+
### How do I get set up? ###
|
|
12
|
+
|
|
13
|
+
* Summary of set up
|
|
14
|
+
* Configuration
|
|
15
|
+
* Dependencies
|
|
16
|
+
* Database configuration
|
|
17
|
+
* How to run tests
|
|
18
|
+
* Deployment instructions
|
|
19
|
+
|
|
20
|
+
### Contribution guidelines ###
|
|
21
|
+
|
|
22
|
+
* Writing tests
|
|
23
|
+
* Code review
|
|
24
|
+
* Other guidelines
|
|
25
|
+
|
|
26
|
+
### Who do I talk to? ###
|
|
27
|
+
|
|
28
|
+
* Repo owner or admin
|
|
29
29
|
* Other community or team contact
|
package/package.json
CHANGED
|
@@ -1210,12 +1210,19 @@ export async function summaryList( req, res ) {
|
|
|
1210
1210
|
[inputData?.sortBy]: sortOrder,
|
|
1211
1211
|
};
|
|
1212
1212
|
}
|
|
1213
|
+
let clusterFilter = [
|
|
1214
|
+
{ 'Teamlead.email': { $in: inputData.RMList } },
|
|
1215
|
+
{ clientId: { $eq: inputData?.clientId } },
|
|
1216
|
+
];
|
|
1217
|
+
if ( inputData?.cluster && inputData?.cluster?.length> 0 ) {
|
|
1218
|
+
clusterFilter.push( {
|
|
1219
|
+
clusterName: { $in: inputData?.cluster },
|
|
1220
|
+
} );
|
|
1221
|
+
}
|
|
1213
1222
|
const clusterQuery =[
|
|
1214
1223
|
{ $match: {
|
|
1215
|
-
$and:
|
|
1216
|
-
|
|
1217
|
-
{ clientId: { $eq: inputData?.clientId } },
|
|
1218
|
-
],
|
|
1224
|
+
$and: clusterFilter,
|
|
1225
|
+
|
|
1219
1226
|
},
|
|
1220
1227
|
},
|
|
1221
1228
|
{ $unwind: { path: '$Teamlead', preserveNullAndEmptyArrays: true } },
|
|
@@ -1350,6 +1357,23 @@ export async function summaryList( req, res ) {
|
|
|
1350
1357
|
$sort: sort,
|
|
1351
1358
|
},
|
|
1352
1359
|
];
|
|
1360
|
+
if ( inputData.searchValue && inputData.searchValue !== '' ) {
|
|
1361
|
+
clusterQuery.push( {
|
|
1362
|
+
$match: {
|
|
1363
|
+
$or: [
|
|
1364
|
+
{ clusterName: { $regex: inputData.searchValue, $options: 'i' } },
|
|
1365
|
+
],
|
|
1366
|
+
},
|
|
1367
|
+
} );
|
|
1368
|
+
|
|
1369
|
+
RMQuery.push( {
|
|
1370
|
+
$match: {
|
|
1371
|
+
$or: [
|
|
1372
|
+
{ RMName: { $regex: inputData.searchValue, $options: 'i' } },
|
|
1373
|
+
],
|
|
1374
|
+
},
|
|
1375
|
+
} );
|
|
1376
|
+
}
|
|
1353
1377
|
const getcount = await aggregateClusters( inputData.keyType === 'rm'?RMQuery: clusterQuery );
|
|
1354
1378
|
const count = getcount?.length || 0;
|
|
1355
1379
|
if ( count == 0 ) {
|
|
@@ -1431,8 +1455,8 @@ export async function summaryList( req, res ) {
|
|
|
1431
1455
|
if ( inputData?.keyType == 'rm' ) {
|
|
1432
1456
|
exportData.push( {
|
|
1433
1457
|
'RM Name': element?.RMName,
|
|
1434
|
-
'
|
|
1435
|
-
'
|
|
1458
|
+
'Clusters Count': element?.clusterCount,
|
|
1459
|
+
'Stores Count': element?.storesCount,
|
|
1436
1460
|
'Total Tango AI Files': element.totalFiles,
|
|
1437
1461
|
'Trust Audit Completed': element.completedFiles,
|
|
1438
1462
|
'Tango Score': element?.complianceScore,
|
|
@@ -1443,7 +1467,7 @@ export async function summaryList( req, res ) {
|
|
|
1443
1467
|
} else {
|
|
1444
1468
|
exportData.push( {
|
|
1445
1469
|
'Cluster Name': element?.clusterName,
|
|
1446
|
-
'
|
|
1470
|
+
'Stores Count': element?.storesCount,
|
|
1447
1471
|
'Total Tango AI Files': element.totalFiles,
|
|
1448
1472
|
'Trust Audit Completed': element.completedFiles,
|
|
1449
1473
|
'Tango Score': element?.complianceScore,
|
|
@@ -1859,16 +1883,16 @@ export async function summaryCard( req, res ) {
|
|
|
1859
1883
|
aggs: {
|
|
1860
1884
|
|
|
1861
1885
|
|
|
1862
|
-
totalFiles: { value_count: { field: '_id' } },
|
|
1886
|
+
'totalFiles': { value_count: { field: '_id' } },
|
|
1863
1887
|
|
|
1864
|
-
completedFiles: {
|
|
1888
|
+
'completedFiles': {
|
|
1865
1889
|
filter: {
|
|
1866
|
-
terms: { 'auditStatus.keyword': [ '
|
|
1890
|
+
terms: { 'auditStatus.keyword': [ 'Audited', 'ReAudited' ] },
|
|
1867
1891
|
},
|
|
1868
1892
|
},
|
|
1869
1893
|
|
|
1870
1894
|
// ratio calc must be inside the same level
|
|
1871
|
-
completedRatio: {
|
|
1895
|
+
'completedRatio': {
|
|
1872
1896
|
bucket_script: {
|
|
1873
1897
|
buckets_path: {
|
|
1874
1898
|
audited: 'completedFiles._count',
|
|
@@ -1878,31 +1902,23 @@ export async function summaryCard( req, res ) {
|
|
|
1878
1902
|
},
|
|
1879
1903
|
},
|
|
1880
1904
|
|
|
1881
|
-
tangoScore: {
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
double totalSum = 0;
|
|
1893
|
-
double totalCount = 0;
|
|
1894
|
-
for (s in states) {
|
|
1895
|
-
totalSum += s.sum;
|
|
1896
|
-
totalCount += s.count;
|
|
1897
|
-
}
|
|
1898
|
-
return totalCount > 0 ? totalSum / totalCount : 0;
|
|
1899
|
-
`,
|
|
1905
|
+
'tangoScore': {
|
|
1906
|
+
'avg': {
|
|
1907
|
+
script: {
|
|
1908
|
+
source: `
|
|
1909
|
+
if (doc['totalSteps'].size() > 0 && doc['coveredStepsAI'].size() > 0 && doc['totalSteps'].value > 0) {
|
|
1910
|
+
return (1.0 * doc['coveredStepsAI'].value / doc['totalSteps'].value) * 100.0;
|
|
1911
|
+
} else {
|
|
1912
|
+
return null;
|
|
1913
|
+
}
|
|
1914
|
+
`,
|
|
1915
|
+
},
|
|
1900
1916
|
},
|
|
1901
1917
|
},
|
|
1902
1918
|
|
|
1903
|
-
trustScore: {
|
|
1919
|
+
'trustScore': {
|
|
1904
1920
|
filter: {
|
|
1905
|
-
terms: { 'auditStatus.keyword': [ '
|
|
1921
|
+
terms: { 'auditStatus.keyword': [ 'Audited', 'ReAudited' ] },
|
|
1906
1922
|
},
|
|
1907
1923
|
aggs: {
|
|
1908
1924
|
avg_val: { avg: { field: 'trustScore' } },
|
|
@@ -1910,7 +1926,7 @@ export async function summaryCard( req, res ) {
|
|
|
1910
1926
|
},
|
|
1911
1927
|
|
|
1912
1928
|
// 5. Past week comparison
|
|
1913
|
-
trend: {
|
|
1929
|
+
'trend': {
|
|
1914
1930
|
date_range: {
|
|
1915
1931
|
field: 'date',
|
|
1916
1932
|
format: 'yyyy-MM-dd',
|
|
@@ -1923,7 +1939,7 @@ export async function summaryCard( req, res ) {
|
|
|
1923
1939
|
total_count: { value_count: { field: '_id' } },
|
|
1924
1940
|
},
|
|
1925
1941
|
},
|
|
1926
|
-
tangoScoreTrend: {
|
|
1942
|
+
'tangoScoreTrend': {
|
|
1927
1943
|
bucket_script: {
|
|
1928
1944
|
buckets_path: {
|
|
1929
1945
|
current: 'trend[\'current\']>total_count',
|
|
@@ -1961,7 +1977,7 @@ export async function summaryCard( req, res ) {
|
|
|
1961
1977
|
const temp= getOutput?.body?.aggregations?.all_docs?.wrapper?.buckets?.filtered;
|
|
1962
1978
|
initialValue.totalFiles =temp?.totalFiles?.value;
|
|
1963
1979
|
initialValue.completedFiles =temp?.completedFiles?.doc_count;
|
|
1964
|
-
initialValue.completedRatio =temp?.completedRatio?.value || 0;
|
|
1980
|
+
initialValue.completedRatio =Math.round( temp?.completedRatio?.value || 0 );
|
|
1965
1981
|
initialValue.tangoScore =Math.round( temp?.tangoScore?.value || 0 );
|
|
1966
1982
|
initialValue.tangoScoreTrend =temp?.tangoScoreTrend?.value || 0;
|
|
1967
1983
|
initialValue.trustScore =temp?.trustScore?.avg_val?.value == null || temp?.trustScore?.avg_val?.value === undefined ? 'NA':Math.round( temp?.trustScore?.avg_val?.value );
|
|
@@ -151,6 +151,9 @@ export const summaryListSchema = joi.object( {
|
|
|
151
151
|
RMList: joi.array().items(
|
|
152
152
|
joi.string().required(),
|
|
153
153
|
).optional(),
|
|
154
|
+
cluster: joi.array().items(
|
|
155
|
+
joi.string().required(),
|
|
156
|
+
).optional(),
|
|
154
157
|
storeId: joi.array().items( joi.string().required() ).required(),
|
|
155
158
|
complianceScore: joi.number().optional().allow( null ),
|
|
156
159
|
nearAddition: joi.string().optional().allow( '' ),
|
|
@@ -21,7 +21,7 @@ eyeTestAuditRouter.post( '/summary-list', isAllowedSessionHandler, accessVerific
|
|
|
21
21
|
eyeTestAuditRouter.post( '/summary-card', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ] } ), validate( summaryCardValid ), summaryCard );
|
|
22
22
|
eyeTestAuditRouter.post( '/email-alert-log', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ] } ), isSuperAdmin, validate( emailAlertLogValid ), emailAlertLog );
|
|
23
23
|
|
|
24
|
-
eyeTestAuditRouter.post( '/cluster-list', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ] } ),
|
|
24
|
+
eyeTestAuditRouter.post( '/cluster-list', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ] } ), validate( clusterListValid ), clusterList );
|
|
25
25
|
eyeTestAuditRouter.get( '/rm-list', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ] } ), isSuperAdmin, validate( rmListValid ), rmList );
|
|
26
26
|
|
|
27
27
|
|