tango-app-api-audit 3.6.46 → 3.6.47

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.46",
3
+ "version": "3.6.47",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -2165,7 +2165,7 @@ export async function summaryList( req, res ) {
2165
2165
  if ( element?._source?.type == 'physical' ) {
2166
2166
  exportData.push( {
2167
2167
  'Date': dayjs( element?._source?.date ).format( 'D MMM, YYYY' ),
2168
- 'Audited Date': [ 'Re-Audited', 'Audited' ].includes( element?._source?.auditStatus )?dayjs( element?._source?.updatedAt ).format( 'D MMM, YYYY' ): 'NA',
2168
+ 'Audited Date': [ 'Re-Audited', 'Audited' ].includes( element?._source?.auditStatus )?dayjs.utc( element?._source?.updatedAt ).add( 5, 'hour' ).add( 30, 'minute' ).format( 'D MMM, YYYY' ): 'NA',
2169
2169
  ...( req?.user?.role === 'superadmin' && { 'RM Name': RMName } ),
2170
2170
  ...( req?.user?.role !== 'user' && { 'Cluster Name': clusterName } ),
2171
2171
  'Store Name': element?._source?.storeName,
@@ -2191,7 +2191,7 @@ export async function summaryList( req, res ) {
2191
2191
  } else {
2192
2192
  exportData.push( {
2193
2193
  'Date': dayjs( element?._source?.date ).format( 'D MMM, YYYY' ),
2194
- 'Audited Date': [ 'Re-Audited', 'Audited' ].includes( element?._source?.auditStatus )?dayjs( element?._source?.updatedAt ).format( 'D MMM, YYYY' ): 'NA',
2194
+ 'Audited Date': [ 'Re-Audited', 'Audited' ].includes( element?._source?.auditStatus )?dayjs.utc( element?._source?.updatedAt ).add( 5, 'hour' ).add( 30, 'minute' ).format( 'D MMM, YYYY' ): 'NA',
2195
2195
  ...( req?.user?.role === 'superadmin' && { 'RM Name': RMName } ),
2196
2196
  ...( req?.user?.role !== 'user' && { 'Cluster Name': clusterName } ),
2197
2197
  'Store Name': element?._source?.storeName,
@@ -2232,39 +2232,6 @@ export async function summaryList( req, res ) {
2232
2232
  let RMEmail = '';
2233
2233
  let clusterName='';
2234
2234
  if ( item?._source?.storeId&&item?._source?.storeId!='' ) {
2235
- // const rmListQuery =[
2236
- // {
2237
- // $match: {
2238
- // $and: [
2239
- // {
2240
- // clientId: { $eq: inputData?.clientId },
2241
- // },
2242
- // {
2243
- // configureType: { $eq: 'user' },
2244
- // },
2245
- // ],
2246
- // },
2247
- // },
2248
- // {
2249
- // $unwind: {
2250
- // path: '$userList', preserveNullAndEmptyArrays: true,
2251
- // },
2252
- // },
2253
- // {
2254
- // $group: {
2255
- // _id: null,
2256
- // list: { $addToSet: '$userList.email' },
2257
- // },
2258
- // },
2259
- // {
2260
- // $project: {
2261
- // _id: 0,
2262
- // list: 1,
2263
- // },
2264
- // },
2265
- // ];
2266
- // const getRMList = await aggregateEyeTestConfig( rmListQuery );
2267
-
2268
2235
  const getRMList = [
2269
2236
  {
2270
2237
  list: [ 'marellapudi.ajay@lenskart.com',
@@ -2358,18 +2325,28 @@ export async function summaryList( req, res ) {
2358
2325
  const testDuration = item?._source?.testDuration;
2359
2326
  const minutes = Math.floor( testDuration / 60 );
2360
2327
  const seconds = testDuration % 60;
2361
- temp[i].complianceScore = `${item?._source?.totalSteps>0 ? Math.round( ( item?._source?.coveredStepsAI/ item?._source?.totalSteps )*100 ): 0} %`;
2362
- 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';
2328
+ temp[i].complianceScore = `${item?._source?.totalSteps > 0 ? Math.round( ( item?._source?.coveredStepsAI / item?._source?.totalSteps ) * 100 ) : 0} %`;
2329
+ 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';
2363
2330
  temp[i].min = minutes;
2364
2331
  temp[i].sec = seconds;
2365
2332
  temp[i].auditedBy = userName?.userName || '';
2366
2333
  temp[i].date = dayjs( item?._source?.date ).format( 'D MMM, YYYY' );
2367
- temp[i].auditedDate = [ 'Re-Audited', 'Audited' ].includes( item?._source?.auditStatus )?dayjs( item?._source?.updatedAt ).format( 'D MMM, YYYY' ): 'NA';
2334
+
2335
+ // auditedDate date conversion from UTC to IST (Indian Standard Time)
2336
+ if ( [ 'Re-Audited', 'Audited' ].includes( item?._source?.auditStatus ) ) {
2337
+ const auditedDate = item?._source?.updatedAt;
2338
+ // Convert auditedDate from UTC to IST
2339
+ const auditedDateIST = dayjs.utc( auditedDate ).add( 5, 'hour' ).add( 30, 'minute' ).format( 'D MMM, YYYY' );
2340
+ temp[i].auditedDate = auditedDateIST;
2341
+ } else {
2342
+ temp[i].auditedDate = 'NA';
2343
+ }
2344
+
2368
2345
  temp[i].RMName = RMName;
2369
- temp[i].clusterName =clusterName;
2370
- temp[i].RMEmail =RMEmail;
2346
+ temp[i].clusterName = clusterName;
2347
+ temp[i].RMEmail = RMEmail;
2371
2348
  const trustScore = temp[i].trustScore;
2372
- temp[i].trustScore = ( trustScore == null || trustScore == undefined ) ? 'NA' :`${trustScore + ' %'}`;
2349
+ temp[i].trustScore = ( trustScore == null || trustScore == undefined ) ? 'NA' : `${trustScore + ' %'}`;
2373
2350
  temp[i]._id = item?._id;
2374
2351
  }
2375
2352
  }