tango-app-api-audit 3.6.13 → 3.6.14
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/package.json
CHANGED
|
@@ -526,7 +526,7 @@ export async function viewFile( req, res ) {
|
|
|
526
526
|
}
|
|
527
527
|
return step;
|
|
528
528
|
} );
|
|
529
|
-
if ( searchData.
|
|
529
|
+
if ( searchData.length ==0 ) {
|
|
530
530
|
return res.sendError( 'No saved records found', 400 );
|
|
531
531
|
}
|
|
532
532
|
if ( searchData.userId !== req.user._id ) {
|
|
@@ -574,7 +574,7 @@ export async function viewFile( req, res ) {
|
|
|
574
574
|
} );
|
|
575
575
|
isEnable=true;
|
|
576
576
|
}
|
|
577
|
-
response
|
|
577
|
+
response?.steps?.sort(
|
|
578
578
|
( a, b ) => order.indexOf( a.processName ) - order.indexOf( b.processName ),
|
|
579
579
|
);
|
|
580
580
|
return res.sendSuccess( { result: response, isEnable: isEnable } );
|
|
@@ -1244,17 +1244,7 @@ export async function summaryList( req, res ) {
|
|
|
1244
1244
|
|
|
1245
1245
|
} );
|
|
1246
1246
|
}
|
|
1247
|
-
if ( inputData.complianceScore && inputData.complianceScore?.length > null ) {
|
|
1248
|
-
const values = Array.isArray( inputData.complianceScore ) ?
|
|
1249
|
-
inputData.complianceScore.map( Number ) :
|
|
1250
|
-
[ Number( inputData.complianceScore ) ];
|
|
1251
|
-
filter.push( {
|
|
1252
|
-
'terms': {
|
|
1253
|
-
'ComplianceScore': values,
|
|
1254
|
-
},
|
|
1255
1247
|
|
|
1256
|
-
} );
|
|
1257
|
-
}
|
|
1258
1248
|
if ( inputData.storeId && inputData.storeId.length > 0 ) {
|
|
1259
1249
|
filter.push( {
|
|
1260
1250
|
|
|
@@ -1267,6 +1257,41 @@ export async function summaryList( req, res ) {
|
|
|
1267
1257
|
return res.sendError( 'No data found', 204 );
|
|
1268
1258
|
}
|
|
1269
1259
|
|
|
1260
|
+
let mustQuery = [
|
|
1261
|
+
...filter,
|
|
1262
|
+
];
|
|
1263
|
+
|
|
1264
|
+
if ( inputData.complianceScore && inputData.complianceScore?.length > null ) {
|
|
1265
|
+
if ( inputData.keyType !== 'store' ) {
|
|
1266
|
+
const rangeShould = inputData?.complianceScore?.map( ( r ) => {
|
|
1267
|
+
const [ gte, lt ] = r.split( '-' ).map( Number );
|
|
1268
|
+
return {
|
|
1269
|
+
range: {
|
|
1270
|
+
ComplianceScore: { gte, lt },
|
|
1271
|
+
},
|
|
1272
|
+
};
|
|
1273
|
+
} );
|
|
1274
|
+
|
|
1275
|
+
mustQuery.push(
|
|
1276
|
+
{
|
|
1277
|
+
bool: {
|
|
1278
|
+
should: rangeShould, // any one of the ranges should match
|
|
1279
|
+
},
|
|
1280
|
+
},
|
|
1281
|
+
);
|
|
1282
|
+
} else {
|
|
1283
|
+
const values = Array.isArray( inputData.complianceScore ) ?
|
|
1284
|
+
inputData.complianceScore.map( Number ) :
|
|
1285
|
+
[ Number( inputData.complianceScore ) ];
|
|
1286
|
+
filter.push( {
|
|
1287
|
+
'terms': {
|
|
1288
|
+
'ComplianceScore': values,
|
|
1289
|
+
},
|
|
1290
|
+
|
|
1291
|
+
} );
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1270
1295
|
if ( inputData?.category ) {
|
|
1271
1296
|
switch ( inputData?.category ) {
|
|
1272
1297
|
case 'fake':
|
|
@@ -1490,6 +1515,7 @@ export async function summaryList( req, res ) {
|
|
|
1490
1515
|
return res.sendError( 'No data', 204 );
|
|
1491
1516
|
}
|
|
1492
1517
|
const temp =[];
|
|
1518
|
+
|
|
1493
1519
|
for ( const [ i, cluster ] of getCluster.entries() ) {
|
|
1494
1520
|
temp.push( cluster );
|
|
1495
1521
|
const getClusterQuery= {
|
|
@@ -1497,7 +1523,7 @@ export async function summaryList( req, res ) {
|
|
|
1497
1523
|
'query': {
|
|
1498
1524
|
'bool': {
|
|
1499
1525
|
'must': [
|
|
1500
|
-
...
|
|
1526
|
+
...mustQuery,
|
|
1501
1527
|
{
|
|
1502
1528
|
'terms': { 'storeId.keyword': cluster?.store },
|
|
1503
1529
|
},
|
|
@@ -1866,6 +1892,7 @@ export async function summaryList( req, res ) {
|
|
|
1866
1892
|
'Queue ID': element?._source?.queueId,
|
|
1867
1893
|
'Tango Score': `${element?._source?.totalSteps>0 ? Math.round( ( element?._source?.coveredStepsAI/ element?._source?.totalSteps )*100 ): 0} %`,
|
|
1868
1894
|
'Steps Covered By AI': element?._source?.coveredStepsAI || 0,
|
|
1895
|
+
'Human Score': [ 'Re-Audited', 'Audited' ].includes( element?._source?.auditStatus )?`${element?._source?.totalSteps>0 ? Math.round( ( element?._source?.auditedSteps/ element?._source?.totalSteps )*100 ): 0} %`:'NA',
|
|
1869
1896
|
'Steps Covered By Human': [ 'Re-Audited', 'Audited' ].includes( element?._source?.auditStatus )?element?._source?.auditedSteps :'NA',
|
|
1870
1897
|
'Trust Score': element?._source?.trustScore == null || element?._source?.trustScore ==undefined ? 'NA' : `${element?._source?.trustScore} %`,
|
|
1871
1898
|
'Visitor Type': element?._source?.visitorsType,
|
|
@@ -1888,6 +1915,7 @@ export async function summaryList( req, res ) {
|
|
|
1888
1915
|
'Store Name': element?._source?.storeName ||'Un Assigned',
|
|
1889
1916
|
'Engagement ID': element?._source?.engagementId,
|
|
1890
1917
|
'Tango Score': `${element?._source?.totalSteps>0 ? Math.round( ( element?._source?.coveredStepsAI/ element?._source?.totalSteps )*100 ): 0} %`,
|
|
1918
|
+
'Human Score': [ 'Re-Audited', 'Audited' ].includes( element?._source?.auditStatus )?`${element?._source?.totalSteps>0 ? Math.round( ( element?._source?.auditedSteps/ element?._source?.totalSteps )*100 ): 0} %`:'NA',
|
|
1891
1919
|
'Steps Covered By AI': element?._source?.coveredStepsAI || 0,
|
|
1892
1920
|
'Steps Covered By Human': [ 'Re-Audited', 'Audited' ].includes( element?._source?.auditStatus )?element?._source?.auditedSteps :'NA',
|
|
1893
1921
|
'Trust Score': element?._source?.trustScore == null || element?._source?.trustScore ==undefined ? 'NA' : `${element?._source?.trustScore} %`,
|
|
@@ -2027,6 +2055,7 @@ export async function summaryList( req, res ) {
|
|
|
2027
2055
|
const minutes = Math.floor( testDuration / 60 );
|
|
2028
2056
|
const seconds = testDuration % 60;
|
|
2029
2057
|
temp[i].complianceScore = `${item?._source?.totalSteps>0 ? Math.round( ( item?._source?.coveredStepsAI/ item?._source?.totalSteps )*100 ): 0} %`;
|
|
2058
|
+
temp[i].humanComplianceScore = [ 'Re-Audited', 'Audited' ].includes( item?._source?.auditStatus )?`${item?._source?.totalSteps>0 ? Math.round( ( item?._source?.auditedSteps/ item?._source?.totalSteps )*100 ): 0} %`:'NA';
|
|
2030
2059
|
temp[i].min = minutes;
|
|
2031
2060
|
temp[i].sec = seconds;
|
|
2032
2061
|
temp[i].auditedBy = userName?.userName || '';
|
|
@@ -2082,18 +2111,42 @@ export async function summaryCard( req, res ) {
|
|
|
2082
2111
|
},
|
|
2083
2112
|
} );
|
|
2084
2113
|
}
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2114
|
+
let mustQuery = [
|
|
2115
|
+
...filter,
|
|
2116
|
+
];
|
|
2117
|
+
if ( inputData.complianceScore && inputData.complianceScore?.length > null ) {
|
|
2118
|
+
if ( inputData.keyType !== 'store' ) {
|
|
2119
|
+
const rangeShould = inputData?.complianceScore?.map( ( r ) => {
|
|
2120
|
+
const [ gte, lt ] = r.split( '-' ).map( Number );
|
|
2121
|
+
return {
|
|
2122
|
+
range: {
|
|
2123
|
+
ComplianceScore: { gte, lt },
|
|
2091
2124
|
},
|
|
2125
|
+
};
|
|
2126
|
+
} );
|
|
2127
|
+
logger.info( { rangeShould: rangeShould } );
|
|
2128
|
+
mustQuery.push(
|
|
2129
|
+
{
|
|
2130
|
+
bool: {
|
|
2131
|
+
should: rangeShould, // any one of the ranges should match
|
|
2132
|
+
},
|
|
2133
|
+
},
|
|
2134
|
+
);
|
|
2135
|
+
} else {
|
|
2136
|
+
const values = Array.isArray( inputData.complianceScore ) ?
|
|
2137
|
+
inputData.complianceScore.map( Number ) :
|
|
2138
|
+
[ Number( inputData.complianceScore ) ];
|
|
2139
|
+
filter.push( {
|
|
2140
|
+
'terms': {
|
|
2141
|
+
'ComplianceScore': values,
|
|
2092
2142
|
},
|
|
2093
|
-
|
|
2143
|
+
|
|
2144
|
+
} );
|
|
2145
|
+
}
|
|
2094
2146
|
}
|
|
2147
|
+
|
|
2095
2148
|
let bool = {
|
|
2096
|
-
'must':
|
|
2149
|
+
'must': mustQuery,
|
|
2097
2150
|
};
|
|
2098
2151
|
if ( inputData?.category ) {
|
|
2099
2152
|
switch ( inputData?.category ) {
|
|
@@ -155,7 +155,7 @@ export const summaryListSchema = joi.object( {
|
|
|
155
155
|
joi.string().optional(),
|
|
156
156
|
).optional(),
|
|
157
157
|
storeId: joi.array().items( joi.string().required() ).required(),
|
|
158
|
-
complianceScore: joi.array().items( joi.
|
|
158
|
+
complianceScore: joi.array().items( joi.string().required() ).optional(),
|
|
159
159
|
nearAddition: joi.string().optional().allow( '' ),
|
|
160
160
|
isExport: joi.boolean().optional(),
|
|
161
161
|
searchValue: joi.string().optional().allow( '' ),
|
|
@@ -222,11 +222,18 @@ export const summaryCardSchema = joi.object( {
|
|
|
222
222
|
otherwise: joi.optional(),
|
|
223
223
|
} ),
|
|
224
224
|
demographics: joi.array().optional(),
|
|
225
|
+
keyType: joi.string()
|
|
226
|
+
.valid( 'rm', 'cluster', 'store' )
|
|
227
|
+
.required()
|
|
228
|
+
.messages( {
|
|
229
|
+
'any.only': 'Please give a valid key type',
|
|
230
|
+
'any.required': 'keyType is required',
|
|
231
|
+
} ),
|
|
225
232
|
RMList: joi.array().items(
|
|
226
233
|
joi.string().optional(),
|
|
227
234
|
).optional(),
|
|
228
235
|
storeId: joi.array().items( joi.string().required() ).required(),
|
|
229
|
-
complianceScore: joi.array().items( joi.
|
|
236
|
+
complianceScore: joi.array().items( joi.string().required() ).optional(),
|
|
230
237
|
nearAddition: joi.string().optional().allow( '' ),
|
|
231
238
|
category: joi.string().optional() .valid( 'fake', 'genuine' ),
|
|
232
239
|
} );
|