tango-app-api-infra 3.9.17 → 3.9.19

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-infra",
3
- "version": "3.9.17",
3
+ "version": "3.9.19",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -4116,7 +4116,7 @@ export async function ticketList( req, res ) {
4116
4116
  'Revised FF': item.status === 'Closed' || item.status === 'Tango Review Done' ? item?.revicedFootfall : '--',
4117
4117
  'Store (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
4118
4118
  'Reviewer (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
4119
- ...( isApprover !== true? 'Tango (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--' ),
4119
+ ...( isApprover !== true? 'Tango (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '' ),
4120
4120
  'Status': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.status || '--',
4121
4121
  'Reviewed by': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdByEmail || '--',
4122
4122
  'Created by': item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.createdByEmail || '--',
@@ -4127,7 +4127,6 @@ export async function ticketList( req, res ) {
4127
4127
  } else {
4128
4128
  for ( let item of ticketListData ) {
4129
4129
  temp.push( {
4130
-
4131
4130
  ticketId: item?.ticketId,
4132
4131
  storeId: item?.storeId,
4133
4132
  storeName: item?.storeName,
@@ -4139,12 +4138,39 @@ export async function ticketList( req, res ) {
4139
4138
  type: item.type || 'store',
4140
4139
  storeRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
4141
4140
  reviewerRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
4142
- ...( isApprover !== true? tangoRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--' ),
4141
+ ...( isApprover !== true? item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc : '' ),
4143
4142
  revicedFootfall: item.status === 'Closed' || item.status === 'Tango Review Done' ?item?.revicedFootfall : '--',
4143
+ ...( function() {
4144
+ let counts = undefined;
4145
+ if ( Array.isArray( item.mappingInfo ) ) {
4146
+ // Priority: tangoreview > approve > review > tagging
4147
+ const targetTypes = [ 'review', 'tagging' ];
4148
+ for ( let type of targetTypes ) {
4149
+ const found = item.mappingInfo.find( ( f ) => f && f.type === type && Array.isArray( f.count ) );
4150
+ if ( found ) {
4151
+ counts = found.count;
4152
+ break;
4153
+ }
4154
+ }
4155
+ }
4156
+ // Fallback to item.count if not found
4157
+ if ( !counts && Array.isArray( item.count ) ) {
4158
+ counts = item.count;
4159
+ }
4160
+ if ( Array.isArray( counts ) ) {
4161
+ return counts.reduce( ( acc, curr ) => {
4162
+ if ( curr && curr.name && typeof curr.value !== 'undefined' ) {
4163
+ acc[curr.name.replace( /\s/g, '' )] = curr.value;
4164
+ // acc[curr.name] = curr.value;
4165
+ }
4166
+ return acc;
4167
+ }, {} );
4168
+ }
4169
+ return {};
4170
+ } )(),
4144
4171
  status: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.status || '--',
4145
4172
  closedDate: item.status === 'Closed' || item.status === 'Tango Review Done' ? item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.updatedAt : '--',
4146
4173
  ReviewedBy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdByEmail || '--',
4147
-
4148
4174
  } );
4149
4175
  }
4150
4176
  }
@@ -4161,6 +4187,8 @@ export async function ticketList( req, res ) {
4161
4187
  'Store Name': item?.storeName,
4162
4188
  'Ticket Raised': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdAt ? dayjs( item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdAt ).format( 'DD MMM, YYYY' ) : '',
4163
4189
  'Issue Date': item?.dateString ? dayjs( item.dateString ).format( 'DD MMM, YYYY' ) : '',
4190
+ 'Ticket Closed Date': item.status === 'Closed' || item.status === 'Tango Review Done' ? dayjs( item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.updatedAt ).format( 'DD MMM, YYYY' ) : '--',
4191
+
4164
4192
  'Due Date': ( () => {
4165
4193
  const dueDate = item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.dueDate;
4166
4194
  if ( dueDate ) {
@@ -4200,6 +4228,8 @@ export async function ticketList( req, res ) {
4200
4228
  } )(),
4201
4229
  'Actual FF': item?.footfallCount,
4202
4230
  // 'Revised FF': item?.revicedFootfall,
4231
+ 'Revised FF': item.status === 'Closed' || item.status === 'Tango Review Done' ? item?.revicedFootfall : '--',
4232
+ 'Ticket Closed Date': item.status === 'Closed' || item.status === 'Tango Review Done' ? dayjs( item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.updatedAt ).format( 'DD MMM, YYYY' ) : '--',
4203
4233
  'Store (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
4204
4234
  'Reviewer (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
4205
4235
  ...( ticketsApproveFeature !== true? 'Tango (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--' ),
@@ -4216,6 +4246,7 @@ export async function ticketList( req, res ) {
4216
4246
  ticketId: item?.ticketId,
4217
4247
  storeId: item?.storeId,
4218
4248
  storeName: item?.storeName,
4249
+ ticketCreatedBy: item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.createdByEmail || '--',
4219
4250
  ticketRaised: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdAt,
4220
4251
  issueDate: item?.dateString,
4221
4252
  footfall: item?.footfallCount,
@@ -4224,8 +4255,38 @@ export async function ticketList( req, res ) {
4224
4255
  type: item.type || 'store',
4225
4256
  storeRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
4226
4257
  reviewerRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
4227
- ...( isApprover !== true? tangoRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--' ),
4258
+ ...( isApprover !== true? tangoRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '' ),
4259
+ revicedFootfall: item.status === 'Closed' || item.status === 'Tango Review Done' ?item?.revicedFootfall : '--',
4260
+ ...( function() {
4261
+ let counts = undefined;
4262
+ if ( Array.isArray( item.mappingInfo ) ) {
4263
+ // Priority: tangoreview > approve > review > tagging
4264
+ const targetTypes = [ 'review', 'tagging' ];
4265
+ for ( let type of targetTypes ) {
4266
+ const found = item.mappingInfo.find( ( f ) => f && f.type === type && Array.isArray( f.count ) );
4267
+ if ( found ) {
4268
+ counts = found.count;
4269
+ break;
4270
+ }
4271
+ }
4272
+ }
4273
+ // Fallback to item.count if not found
4274
+ if ( !counts && Array.isArray( item.count ) ) {
4275
+ counts = item.count;
4276
+ }
4277
+ if ( Array.isArray( counts ) ) {
4278
+ return counts.reduce( ( acc, curr ) => {
4279
+ if ( curr && curr.name && typeof curr.value !== 'undefined' ) {
4280
+ acc[curr.name.replace( /\s/g, '' )] = curr.value;
4281
+ // acc[curr.name] = curr.value;
4282
+ }
4283
+ return acc;
4284
+ }, {} );
4285
+ }
4286
+ return {};
4287
+ } )(),
4228
4288
  status: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.status || '--',
4289
+ closedDate: item.status === 'Closed' || item.status === 'Tango Review Done' ? item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.updatedAt : '--',
4229
4290
  ReviewedBy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdByEmail || '--',
4230
4291
 
4231
4292
  } );