tango-app-api-audit 3.5.40 → 3.5.42

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-audit",
3
- "version": "3.5.40",
3
+ "version": "3.5.42",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -255,9 +255,9 @@ export async function getList( req, res ) {
255
255
  'Store ID': element?._source?.storeId || 'Un Assigned',
256
256
  'Store Name': element?._source?.storeName ||'Un Assigned',
257
257
  'Engagement ID': element?._source?.engagementId,
258
- 'Compliance Score': element?._source?.totalSteps>0 ? Math.round( ( element?._source?.coveredStepsAI/ element?._source?.totalSteps )*100 ): 0,
258
+ 'Compliance Score': element?._source?.totalSteps>0 ? Math.round( ( element?._source?.coveredStepsAI/ element?._source?.totalSteps )*100 )+' %': '0 %',
259
259
  'Steps Covered By AI': element?._source?.coveredStepsAI || 0,
260
- 'Trust Score': element?._source?.trustScore ||0,
260
+ 'Trust Score': `${element?._source?.trustScore || 0} %`,
261
261
  'Test Duration': duration || '',
262
262
  'Audit Status': element?._source?.auditStatus || '',
263
263
  'Audited By': userName?.userName || '',
@@ -280,7 +280,8 @@ export async function getList( req, res ) {
280
280
  const testDuration = searchValue[i]?._source?.testDuration;
281
281
  const minutes = Math.floor( testDuration / 60 );
282
282
  const seconds = testDuration % 60;
283
- searchValue[i]._source.complianceScore = searchValue[i]?._source?.totalSteps>0 ? Math.round( ( searchValue[i]?._source?.coveredStepsAI/ searchValue[i]?._source?.totalSteps )*100 ): 0;
283
+ searchValue[i]._source.complianceScore = searchValue[i]?._source?.totalSteps>0 ? Math.round( ( searchValue[i]?._source?.coveredStepsAI/ searchValue[i]?._source?.totalSteps )*100 ) + ' %': '0 %';
284
+ searchValue[i]._source.trustScore = searchValue[i]._source.trustScore !== null && searchValue[i]._source.trustScore !== undefined? Math( searchValue[i]._source.trustScore ) + ' %': 'NA';
284
285
  searchValue[i]._source.min = minutes;
285
286
  searchValue[i]._source.sec = seconds;
286
287
  searchValue[i]._source.auditedBy = userName?.userName || '';
@@ -1178,6 +1179,26 @@ export async function summaryList( req, res ) {
1178
1179
  return res.sendError( 'No data found', 204 );
1179
1180
  }
1180
1181
 
1182
+ if ( inputData?.category ) {
1183
+ switch ( inputData?.category ) {
1184
+ case 'fake':
1185
+ filter.push( {
1186
+ term: {
1187
+ 'comment.keyword': 'Possible Fake Video',
1188
+ },
1189
+ } );
1190
+ break;
1191
+ case 'genuine':
1192
+ filter.push( {
1193
+ term: {
1194
+ 'comment.keyword': '',
1195
+ },
1196
+ } );
1197
+ break;
1198
+ default: return res.sendError( 'Give valid Category', 400 );
1199
+ }
1200
+ }
1201
+
1181
1202
 
1182
1203
  if ( inputData.keyType === 'rm' || inputData.keyType === 'cluster' ) {
1183
1204
  let sort ={
@@ -1364,17 +1385,10 @@ export async function summaryList( req, res ) {
1364
1385
  'query': {
1365
1386
  'bool': {
1366
1387
  'must': [
1367
- { 'terms': { 'storeId.keyword': cluster?.store } },
1368
- { 'term': { 'type.keyword': inputData?.type } },
1388
+ ...filter,
1369
1389
  {
1370
- 'range': {
1371
- 'date': {
1372
- 'gte': inputData?.fromDate,
1373
- 'lte': inputData?.toDate,
1374
- },
1375
- },
1390
+ 'terms': { 'storeId.keyword': cluster?.store },
1376
1391
  },
1377
-
1378
1392
  ],
1379
1393
  },
1380
1394
  },
@@ -1405,7 +1419,7 @@ export async function summaryList( req, res ) {
1405
1419
  temp[i].totalFiles = getResponse?.body?.aggregations?.total_count?.value || 0,
1406
1420
  temp[i].completedFiles=getResponse?.body?.aggregations?.audited_trustScore?.totalCount?.value || 0;
1407
1421
  temp[i].complianceScore = `${ Math.round( getResponse?.body?.aggregations?.avg_complianceScore?.value || 0 )} %`;
1408
- temp[i].trustScore =`${getResponse?.body?.aggregations?.audited_trustScore?.totalCount?.value + ' %' || 'NA'}`;
1422
+ temp[i].trustScore = getResponse?.body?.aggregations?.audited_trustScore?.avg_trustScore?.value ==null || getResponse?.body?.aggregations?.audited_trustScore?.avg_trustScore?.value == undefined ?'NA':`${Math.round( getResponse?.body?.aggregations?.audited_trustScore?.avg_trustScore?.value ) + ' %'}`;
1409
1423
  }
1410
1424
  }
1411
1425
 
@@ -1659,7 +1673,7 @@ export async function summaryList( req, res ) {
1659
1673
  'Engagement ID': element?._source?.engagementId,
1660
1674
  'Tango Score': `${element?._source?.totalSteps>0 ? Math.round( ( element?._source?.coveredStepsAI/ element?._source?.totalSteps )*100 ): 0} %`,
1661
1675
  'Steps Covered By AI': element?._source?.coveredStepsAI || 0,
1662
- 'Trust Score': `${element?._source?.trustScore ||0}`,
1676
+ 'Trust Score': `${element?._source?.trustScore ||0} %`,
1663
1677
  'Test Duration': duration || '',
1664
1678
  'Audit Status': element?._source?.auditStatus || '',
1665
1679
  'Audited By': userName?.userName || '',