tango-app-api-analysis-traffic 3.8.24 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-analysis-traffic",
3
- "version": "3.8.24",
3
+ "version": "3.8.25",
4
4
  "description": "Traffic Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1276,9 +1276,22 @@ export async function storeProcessedData( req, res ) {
1276
1276
  const hit = footfallDirRes?.body?.hits?.hits?.[0];
1277
1277
  receivedfootfall = hit._source.footfallCount;
1278
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
+ }
1279
1291
  } catch ( err ) {
1280
1292
  logger.warn( { message: 'Could not get ticket status from footfallDirectory', error: err } );
1281
1293
  }
1294
+
1282
1295
  // Check if request status ("raised") should be enabled or disabled by querying MongoDB config
1283
1296
  // We'll assume findOnerevopConfig can fetch the record with status for this storeId and dateString
1284
1297
  let raisedStatusEnabled = 'reset'; // default: enabled