tango-app-api-audit 3.6.15 → 3.6.17

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.6.15",
3
+ "version": "3.6.17",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1264,10 +1264,10 @@ export async function summaryList( req, res ) {
1264
1264
  if ( inputData.complianceScore && inputData.complianceScore?.length > null ) {
1265
1265
  if ( inputData.keyType !== 'store' ) {
1266
1266
  const rangeShould = inputData?.complianceScore?.map( ( r ) => {
1267
- const [ gte, lt ] = r.split( '-' ).map( Number );
1267
+ const [ gte, lte ] = r.split( '-' ).map( Number );
1268
1268
  return {
1269
1269
  range: {
1270
- ComplianceScore: { gte, lt },
1270
+ ComplianceScore: { gte, lte },
1271
1271
  },
1272
1272
  };
1273
1273
  } );
@@ -1276,6 +1276,7 @@ export async function summaryList( req, res ) {
1276
1276
  {
1277
1277
  bool: {
1278
1278
  should: rangeShould, // any one of the ranges should match
1279
+ minimum_should_match: 1,
1279
1280
  },
1280
1281
  },
1281
1282
  );
@@ -1550,6 +1551,7 @@ export async function summaryList( req, res ) {
1550
1551
  },
1551
1552
  },
1552
1553
  };
1554
+ logger.info( { getClusterQuery: getClusterQuery } );
1553
1555
  const getResponse = await getOpenSearchData( openSearch.EyeTestInput, getClusterQuery );
1554
1556
  if ( getResponse?.body?.aggregations ) {
1555
1557
  delete temp[i].store;
@@ -2117,10 +2119,10 @@ export async function summaryCard( req, res ) {
2117
2119
  if ( inputData.complianceScore && inputData.complianceScore?.length > null ) {
2118
2120
  if ( inputData.keyType !== 'store' ) {
2119
2121
  const rangeShould = inputData?.complianceScore?.map( ( r ) => {
2120
- const [ gte, lt ] = r.split( '-' ).map( Number );
2122
+ const [ gte, lte ] = r.split( '-' ).map( Number );
2121
2123
  return {
2122
2124
  range: {
2123
- ComplianceScore: { gte, lt },
2125
+ ComplianceScore: { gte, lte },
2124
2126
  },
2125
2127
  };
2126
2128
  } );
@@ -2128,6 +2130,7 @@ export async function summaryCard( req, res ) {
2128
2130
  {
2129
2131
  bool: {
2130
2132
  should: rangeShould, // any one of the ranges should match
2133
+ minimum_should_match: 1,
2131
2134
  },
2132
2135
  },
2133
2136
  );
@@ -2259,6 +2262,34 @@ export async function summaryCard( req, res ) {
2259
2262
  },
2260
2263
  },
2261
2264
 
2265
+
2266
+ 'humanScore': {
2267
+ filter: {
2268
+ terms: {
2269
+ 'auditStatus.keyword': [ 'Audited', 'ReAudited' ],
2270
+ },
2271
+ },
2272
+ aggs: {
2273
+ scoreValue: {
2274
+ avg: {
2275
+ script: {
2276
+ source: `
2277
+ if (doc['totalSteps'].size() > 0
2278
+ && doc['auditedSteps'].size() > 0
2279
+ && doc['totalSteps'].value > 0) {
2280
+ return (1.0 * doc['auditedSteps'].value / doc['totalSteps'].value) * 100.0;
2281
+ } else {
2282
+ return null;
2283
+ }
2284
+ `,
2285
+ lang: 'painless',
2286
+ },
2287
+ },
2288
+ },
2289
+ },
2290
+ },
2291
+
2292
+
2262
2293
  'trustScore': {
2263
2294
  filter: {
2264
2295
  terms: { 'auditStatus.keyword': [ 'Audited', 'Re-Audited' ] },
@@ -2312,6 +2343,7 @@ export async function summaryCard( req, res ) {
2312
2343
  completedFiles: 0,
2313
2344
  completedRatio: 0,
2314
2345
  tangoScore: 0,
2346
+ humanScore: 0,
2315
2347
  tangoScoreTrend: 0,
2316
2348
  trustScore: 0,
2317
2349
  trend: false,
@@ -2322,6 +2354,7 @@ export async function summaryCard( req, res ) {
2322
2354
  initialValue.completedFiles =temp?.completedFiles?.doc_count;
2323
2355
  initialValue.completedRatio =Math.round( temp?.completedRatio?.value || 0 );
2324
2356
  initialValue.tangoScore =Math.round( temp?.tangoScore?.value || 0 )+ ' %';
2357
+ initialValue.humanScore =Math.round( temp?.humanScore?.scoreValue?.value || 0 )+ ' %';
2325
2358
  initialValue.tangoScoreTrend =temp?.tangoScoreTrend?.value || 0;
2326
2359
  initialValue.trustScore =temp?.trustScore?.avg_val?.value == null || temp?.trustScore?.avg_val?.value === undefined ? 'NA':Math.round( temp?.trustScore?.avg_val?.value );
2327
2360
  initialValue.trend = initialValue.tangoScoreTrend < 0? false : true;