tango-app-api-trax 3.9.65 → 3.9.67

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-trax",
3
- "version": "3.9.65",
3
+ "version": "3.9.67",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -925,8 +925,6 @@ export const flagTablesV1 = async ( req, res ) => {
925
925
 
926
926
  // Lamda Service Call //
927
927
  async function LamdaServiceCall( url, data, timeoutMs = 8000 ) {
928
- const controller = new AbortController();
929
- const timer = setTimeout( () => controller.abort(), timeoutMs );
930
928
  try {
931
929
  const requestOptions = {
932
930
  method: 'POST',
@@ -934,8 +932,6 @@ async function LamdaServiceCall( url, data, timeoutMs = 8000 ) {
934
932
  'Content-Type': 'application/json',
935
933
  },
936
934
  body: JSON.stringify( data ),
937
- keepalive: true,
938
- signal: controller.signal,
939
935
  };
940
936
  const response = await fetch( url, requestOptions );
941
937
  if ( !response.ok ) {
@@ -946,8 +942,6 @@ async function LamdaServiceCall( url, data, timeoutMs = 8000 ) {
946
942
  } catch ( error ) {
947
943
  logger.error( { error: error, message: data, function: 'LamdaServiceCall' } );
948
944
  return false;
949
- } finally {
950
- clearTimeout( timer );
951
945
  }
952
946
  }
953
947
 
@@ -2306,6 +2300,8 @@ export const flagTablesV2 = async ( req, res ) => {
2306
2300
  mayNeedLambda ? LamdaServiceCall( LamdaURL, detectionPayload ) : Promise.resolve( null ),
2307
2301
  ] );
2308
2302
 
2303
+ console.log( lambdaResultData );
2304
+
2309
2305
  if ( !getChecklistPerformanceData?.length ) {
2310
2306
  return res.sendError( 'No data found', 204 );
2311
2307
  }
@@ -2364,7 +2360,20 @@ export const flagTablesV2 = async ( req, res ) => {
2364
2360
  // their real (merged) flaggedStores / flagCount / complianceRate / assignedStores
2365
2361
  // instead of the stale pre-merge values. Numeric columns (incl. complianceRate,
2366
2362
  // which is a fixed-point string) compare numerically; text columns fall back to locale.
2367
- const sortColumnName = requestData.sortColumnName;
2363
+ // The UI sends some columns as display labels (e.g. 'Compliance') rather than the
2364
+ // data field name, so map those to the real keys; raw field names pass through.
2365
+ const SORT_FIELD_MAP = {
2366
+ 'Compliance': 'complianceRate',
2367
+ 'Checklist Name': 'checkListName',
2368
+ 'Coverage': 'coverage',
2369
+ 'Assigned Stores': 'assignedStores',
2370
+ 'Flagged Stores': 'flaggedStores',
2371
+ 'Question Flags': 'customQuestionFlagCount',
2372
+ 'Not Submitted Flags': 'customTimeFlagCount',
2373
+ 'Detection Flags': 'flagCount',
2374
+ 'Flags': 'flagCount',
2375
+ };
2376
+ const sortColumnName = SORT_FIELD_MAP[requestData.sortColumnName] || requestData.sortColumnName;
2368
2377
  if ( sortColumnName && sortColumnName != '' && requestData.sortBy && requestData.sortBy != '' ) {
2369
2378
  const sortDir = parseInt( requestData.sortBy, 10 ) === -1 ? -1 : 1;
2370
2379
  getChecklistPerformanceData.sort( ( a, b ) => {