tango-app-api-trax 3.9.65 → 3.9.66

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.66",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -2364,7 +2364,20 @@ export const flagTablesV2 = async ( req, res ) => {
2364
2364
  // their real (merged) flaggedStores / flagCount / complianceRate / assignedStores
2365
2365
  // instead of the stale pre-merge values. Numeric columns (incl. complianceRate,
2366
2366
  // which is a fixed-point string) compare numerically; text columns fall back to locale.
2367
- const sortColumnName = requestData.sortColumnName;
2367
+ // The UI sends some columns as display labels (e.g. 'Compliance') rather than the
2368
+ // data field name, so map those to the real keys; raw field names pass through.
2369
+ const SORT_FIELD_MAP = {
2370
+ 'Compliance': 'complianceRate',
2371
+ 'Checklist Name': 'checkListName',
2372
+ 'Coverage': 'coverage',
2373
+ 'Assigned Stores': 'assignedStores',
2374
+ 'Flagged Stores': 'flaggedStores',
2375
+ 'Question Flags': 'customQuestionFlagCount',
2376
+ 'Not Submitted Flags': 'customTimeFlagCount',
2377
+ 'Detection Flags': 'flagCount',
2378
+ 'Flags': 'flagCount',
2379
+ };
2380
+ const sortColumnName = SORT_FIELD_MAP[requestData.sortColumnName] || requestData.sortColumnName;
2368
2381
  if ( sortColumnName && sortColumnName != '' && requestData.sortBy && requestData.sortBy != '' ) {
2369
2382
  const sortDir = parseInt( requestData.sortBy, 10 ) === -1 ? -1 : 1;
2370
2383
  getChecklistPerformanceData.sort( ( a, b ) => {