tango-app-api-trax 3.9.49 → 3.9.51

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.49",
3
+ "version": "3.9.51",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1825,7 +1825,7 @@ export async function sopMobilechecklistMultiSectionFormatterv2( req, res, next
1825
1825
  structure.multiQuestionReferenceImage = qaAnswers[j].multiQuestionReferenceImage || [];
1826
1826
  structure.descriptivetype = qaAnswers[j].descriptivetype;
1827
1827
  structure.allowMultiple = qaAnswers[j].allowMultiple;
1828
- structure.compliance = qaAnswers[j]?.compliance;
1828
+ structure.compliance = ( requestSection[i]?.answer && ( requestSection[i]?.answer?.toLowerCase() === 'n/a' || requestSection[i]?.answer?.toLowerCase() === 'na' ) )? 0 : qaAnswers[j]?.compliance;
1829
1829
  // structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
1830
1830
  structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
1831
1831
  if ( qaAnswers[j]?.taskId ) {
@@ -1822,6 +1822,8 @@ export const checklistDropdownV1 = async ( req, res ) => {
1822
1822
  sourceCheckList_id: 1,
1823
1823
  checkListName: 1,
1824
1824
  coverage: 1,
1825
+ // aiStoreList is an array of store-id strings; keep it (default []).
1826
+ aiStoreList: { $ifNull: [ '$aiStoreList', [] ] },
1825
1827
  },
1826
1828
  },
1827
1829
  {
@@ -1829,6 +1831,8 @@ export const checklistDropdownV1 = async ( req, res ) => {
1829
1831
  _id: '$sourceCheckList_id',
1830
1832
  checkListName: { $last: '$checkListName' },
1831
1833
  coverage: { $last: '$coverage' },
1834
+ // Collect each document's array; flattened/deduped in the next stage.
1835
+ aiStoreList: { $push: '$aiStoreList' },
1832
1836
  },
1833
1837
  },
1834
1838
  {
@@ -1837,6 +1841,14 @@ export const checklistDropdownV1 = async ( req, res ) => {
1837
1841
  sourceCheckList_id: '$_id',
1838
1842
  checkListName: 1,
1839
1843
  coverage: 1,
1844
+ // Union the per-document arrays into one deduplicated list of store ids.
1845
+ aiStoreList: {
1846
+ $reduce: {
1847
+ input: '$aiStoreList',
1848
+ initialValue: [],
1849
+ in: { $setUnion: [ '$$value', '$$this' ] },
1850
+ },
1851
+ },
1840
1852
  },
1841
1853
  },
1842
1854
  {
@@ -1884,6 +1896,7 @@ export const checklistDropdownV1 = async ( req, res ) => {
1884
1896
  scheduleStartTime: '$checklistData.scheduleStartTime',
1885
1897
  sourceCheckList_id: '$checklistData._id',
1886
1898
  coverage: 1,
1899
+ aiStoreList: 1,
1887
1900
  },
1888
1901
  },
1889
1902
  ];
@@ -2268,7 +2281,6 @@ export const flagTablesV2 = async ( req, res ) => {
2268
2281
  } );
2269
2282
 
2270
2283
  let getTotalCount = await processedchecklistService.aggregate( findQuery );
2271
- console.log( getTotalCount );
2272
2284
  if ( !getTotalCount.length ) {
2273
2285
  return res.sendError( { error: 'No Data Found' }, 204 );
2274
2286
  }
@@ -2352,14 +2364,14 @@ export const flagTablesV2 = async ( req, res ) => {
2352
2364
  'Checklist Name': element.checkListName,
2353
2365
  'Coverage': element?.coverage,
2354
2366
  'No of Questions': element?.runAIQuestionCount,
2355
- 'Assigned Stores': element?.checkListType === 'custom' ? element?.assignedStores : element?.assignedStoresAi,
2367
+ 'Assigned Stores': element?.checkListType === 'custom' ? element?.assignedStores : element?.aiStoreList?.length,
2356
2368
  'Flagged Stores': element?.flaggedStores,
2357
2369
  'Question Flags': element?.customQuestionFlagCount,
2358
2370
  ...( element.runAIFlag ? { 'Run AI Flag': element.runAIFlag } : {} ),
2359
2371
  'Not Submitted Flags': element?.customTimeFlagCount,
2360
2372
  'Detection Flags': element?.flagCount,
2361
2373
  'Flags': element?.flagCount,
2362
- 'Compliance': element?.complianceRate,
2374
+ 'Compliance': element?.checkListType === 'activitymonitoring' ? 'NA' : element?.complianceRate,
2363
2375
  // 'Flag Type': element?.checkListType === 'custom' ? 'Question' : 'Detection',
2364
2376
  };
2365
2377
  if ( requestData?.filter === 'all' ) {