tango-app-api-analysis-traffic 3.8.23 → 3.8.25
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
|
@@ -1082,6 +1082,13 @@ export async function exportRevopTagging( req, res ) {
|
|
|
1082
1082
|
}
|
|
1083
1083
|
|
|
1084
1084
|
const exportData = [];
|
|
1085
|
+
// Convert camelCase revopsType to space-separated, capitalized words (e.g. nonShopper -> Non Shopper)
|
|
1086
|
+
const camelCaseToTitle = ( str ) => {
|
|
1087
|
+
if ( !str ) return '';
|
|
1088
|
+
return `${str}`
|
|
1089
|
+
.replace( /([a-z0-9])([A-Z])/g, '$1 $2' )
|
|
1090
|
+
.replace( /^./, ( s ) => s.toUpperCase() );
|
|
1091
|
+
};
|
|
1085
1092
|
logger.info( { allHits: allHits } );
|
|
1086
1093
|
for ( const hit of allHits ) {
|
|
1087
1094
|
const src = hit._source || {};
|
|
@@ -1121,7 +1128,7 @@ export async function exportRevopTagging( req, res ) {
|
|
|
1121
1128
|
const subCategory = Array.isArray( issueItem?.issue ) ? issueItem.issue.join( ', ' ) : ( issueItem?.issue || '' );
|
|
1122
1129
|
exportData.push( {
|
|
1123
1130
|
...base,
|
|
1124
|
-
'Tag Type': revopsType,
|
|
1131
|
+
'Tag Type': camelCaseToTitle( revopsType ),
|
|
1125
1132
|
'Tagged Category': issueItem?.name || '',
|
|
1126
1133
|
'Tagged Sub Category': subCategory,
|
|
1127
1134
|
'Description': src.description || '',
|
|
@@ -1130,7 +1137,7 @@ export async function exportRevopTagging( req, res ) {
|
|
|
1130
1137
|
} else {
|
|
1131
1138
|
exportData.push( {
|
|
1132
1139
|
...base,
|
|
1133
|
-
'Tag Type': revopsType,
|
|
1140
|
+
'Tag Type': camelCaseToTitle( revopsType ),
|
|
1134
1141
|
'Tagged Category': typeLower === 'nonshopper' ? ( src.nonshoperType || '' ) : '',
|
|
1135
1142
|
'Tagged Sub Category': '',
|
|
1136
1143
|
'Description': src.description || '',
|
|
@@ -1269,9 +1276,22 @@ export async function storeProcessedData( req, res ) {
|
|
|
1269
1276
|
const hit = footfallDirRes?.body?.hits?.hits?.[0];
|
|
1270
1277
|
receivedfootfall = hit._source.footfallCount;
|
|
1271
1278
|
ticketStatus = hit?._source?.status;
|
|
1279
|
+
// For accuracy-issue statuses, decide the final status based on the client's
|
|
1280
|
+
// footfallDirectoryConfigs.tangoApproved flag from the client collection.
|
|
1281
|
+
const accuracyIssueStatuses = [ 'Open - Accuracy Issue', 'Closed - Accuracy Issue' ];
|
|
1282
|
+
if ( accuracyIssueStatuses.includes( ticketStatus ) ) {
|
|
1283
|
+
const clientId = `${storeId}`.split( '-' )[0];
|
|
1284
|
+
const clientConfig = await clientService.findOne( { clientId: clientId }, { 'footfallDirectoryConfigs.tangoApproved': 1 } );
|
|
1285
|
+
// If config exists and tangoApproved is true, keep the existing status;
|
|
1286
|
+
// otherwise treat it as 'Closed'.
|
|
1287
|
+
if ( clientConfig?.footfallDirectoryConfigs?.tangoApproved !== true ) {
|
|
1288
|
+
ticketStatus = 'Closed';
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1272
1291
|
} catch ( err ) {
|
|
1273
1292
|
logger.warn( { message: 'Could not get ticket status from footfallDirectory', error: err } );
|
|
1274
1293
|
}
|
|
1294
|
+
|
|
1275
1295
|
// Check if request status ("raised") should be enabled or disabled by querying MongoDB config
|
|
1276
1296
|
// We'll assume findOnerevopConfig can fetch the record with status for this storeId and dateString
|
|
1277
1297
|
let raisedStatusEnabled = 'reset'; // default: enabled
|