tango-app-api-infra 3.9.18 → 3.9.20

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.18",
3
+ "version": "3.9.20",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -4139,7 +4139,35 @@ export async function ticketList( req, res ) {
4139
4139
  storeRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
4140
4140
  reviewerRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
4141
4141
  ...( isApprover !== true? item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc : '' ),
4142
- revicedFootfall: item.status === 'Closed' || item.status === 'Tango Review Done' ?item?.revicedFootfall : '--',
4142
+ revicedFF: 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
+ } )(),
4143
4171
  status: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.status || '--',
4144
4172
  closedDate: item.status === 'Closed' || item.status === 'Tango Review Done' ? item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.updatedAt : '--',
4145
4173
  ReviewedBy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdByEmail || '--',
@@ -4159,6 +4187,8 @@ export async function ticketList( req, res ) {
4159
4187
  'Store Name': item?.storeName,
4160
4188
  'Ticket Raised': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdAt ? dayjs( item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdAt ).format( 'DD MMM, YYYY' ) : '',
4161
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
+
4162
4192
  'Due Date': ( () => {
4163
4193
  const dueDate = item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.dueDate;
4164
4194
  if ( dueDate ) {
@@ -4198,6 +4228,8 @@ export async function ticketList( req, res ) {
4198
4228
  } )(),
4199
4229
  'Actual FF': item?.footfallCount,
4200
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' ) : '--',
4201
4233
  'Store (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
4202
4234
  'Reviewer (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
4203
4235
  ...( ticketsApproveFeature !== true? 'Tango (Accuracy%)': item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '--' ),
@@ -4214,6 +4246,7 @@ export async function ticketList( req, res ) {
4214
4246
  ticketId: item?.ticketId,
4215
4247
  storeId: item?.storeId,
4216
4248
  storeName: item?.storeName,
4249
+ ticketCreatedBy: item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.createdByEmail || '--',
4217
4250
  ticketRaised: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdAt,
4218
4251
  issueDate: item?.dateString,
4219
4252
  footfall: item?.footfallCount,
@@ -4223,7 +4256,37 @@ export async function ticketList( req, res ) {
4223
4256
  storeRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tagging' )?.revicedPerc || '--',
4224
4257
  reviewerRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.revicedPerc || '--',
4225
4258
  ...( isApprover !== true? tangoRevisedAccuracy: item?.mappingInfo?.find( ( f ) => f.type === 'tangoreview' )?.revicedPerc || '' ),
4259
+ revicedFF: 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
+ } )(),
4226
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 : '--',
4227
4290
  ReviewedBy: item?.mappingInfo?.find( ( f ) => f.type === 'review' )?.createdByEmail || '--',
4228
4291
 
4229
4292
  } );