tango-app-api-trax 3.7.74 → 3.7.75-temp

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.
@@ -618,7 +618,7 @@ export const flagCardsV1 = async ( req, res ) => {
618
618
  // }
619
619
 
620
620
  const detectionPayload = { fromDate, toDate, storeId, clientId };
621
- const lambdaURL = 'https://f65azvtljclaxp6l7rnx65cdmm0lcgvp.lambda-url.ap-south-1.on.aws/';
621
+ const lambdaURL = 'https://n2xaqf3wdy4uf53n6rpr66y2gm0xuuxf.lambda-url.ap-south-1.on.aws/';
622
622
  const resultData = await LamdaServiceCall( lambdaURL, detectionPayload );
623
623
 
624
624
 
@@ -760,7 +760,7 @@ export const flagComparisonCardsV1 = async ( req, res ) => {
760
760
  return 0;
761
761
  }
762
762
 
763
- const LamdaURL = 'https://f65azvtljclaxp6l7rnx65cdmm0lcgvp.lambda-url.ap-south-1.on.aws/';
763
+ const LamdaURL = 'https://n2xaqf3wdy4uf53n6rpr66y2gm0xuuxf.lambda-url.ap-south-1.on.aws/';
764
764
  const resultData = await LamdaServiceCall( LamdaURL, detectionPayload );
765
765
  const published = publishedAiChecklists.map( ( val ) => val?.checkListType );
766
766
  if ( resultData?.status_code === '200' ) {
@@ -1062,7 +1062,7 @@ export const flagTablesV1 = async ( req, res ) => {
1062
1062
  'clientId': requestData.clientId,
1063
1063
  };
1064
1064
 
1065
- let LamdaURL = 'https://f65azvtljclaxp6l7rnx65cdmm0lcgvp.lambda-url.ap-south-1.on.aws/';
1065
+ let LamdaURL = 'https://n2xaqf3wdy4uf53n6rpr66y2gm0xuuxf.lambda-url.ap-south-1.on.aws/';
1066
1066
  let resultData = await LamdaServiceCall( LamdaURL, detectionPayload );
1067
1067
  if ( resultData ) {
1068
1068
  if ( resultData.status_code == '200' ) {
@@ -2040,7 +2040,7 @@ export const flagChecklistCardsV1 = async ( req, res ) => {
2040
2040
  const checklist = await aggregate( pipeline );
2041
2041
  console.log( '🚀 ~ flagChecklistCardsV1 ~ checklist:', checklist );
2042
2042
  reqestData.storeCount = checklist[0]?.storeCount | 0;
2043
- let LamdaURL = 'https://k462fpztd3zaucty5ruoks6z540qqgqj.lambda-url.ap-south-1.on.aws/';
2043
+ let LamdaURL = 'https://uicachpj46gtd42336apkjsb3i0rcycz.lambda-url.ap-south-1.on.aws/';
2044
2044
  let resultData = await LamdaServiceCall( LamdaURL, reqestData );
2045
2045
  console.log( '🚀 ~ flagChecklistCardsV1 ~ resultData:', resultData );
2046
2046
  if ( resultData ) {
@@ -2392,7 +2392,7 @@ export const flagChecklistComparisonCardsV1 = async ( req, res ) => {
2392
2392
 
2393
2393
  const to = await aggregate( toPipeline );
2394
2394
  requestData.range2StoreCount = to[0]?.storeCount | 0;
2395
- let LamdaURL = 'https://5m55vcuecg2hll7jzfppx6h53y0lvcmq.lambda-url.ap-south-1.on.aws/';
2395
+ let LamdaURL = 'https://gnczcmpa63lz6kidu6ywj5ombu0rffqf.lambda-url.ap-south-1.on.aws/';
2396
2396
  let resultData = await LamdaServiceCall( LamdaURL, requestData );
2397
2397
  // console.log( 'resultData =>', resultData );
2398
2398
  if ( resultData ) {
@@ -2953,7 +2953,7 @@ export const flagComparisonCardsV2 = async ( req, res ) => {
2953
2953
  // return 0;
2954
2954
  // }
2955
2955
 
2956
- const LamdaURL = 'https://f65azvtljclaxp6l7rnx65cdmm0lcgvp.lambda-url.ap-south-1.on.aws/';
2956
+ const LamdaURL = 'https://n2xaqf3wdy4uf53n6rpr66y2gm0xuuxf.lambda-url.ap-south-1.on.aws/';
2957
2957
  const resultData = await LamdaServiceCall( LamdaURL, detectionPayload );
2958
2958
  const published = publishedAiChecklists.map( ( val ) => val?.checkListType );
2959
2959
  if ( resultData?.status_code === '200' ) {
@@ -3226,7 +3226,7 @@ export const flagTablesV2 = async ( req, res ) => {
3226
3226
  'clientId': requestData.clientId,
3227
3227
  };
3228
3228
 
3229
- let LamdaURL = 'https://f65azvtljclaxp6l7rnx65cdmm0lcgvp.lambda-url.ap-south-1.on.aws/';
3229
+ let LamdaURL = 'https://n2xaqf3wdy4uf53n6rpr66y2gm0xuuxf.lambda-url.ap-south-1.on.aws/';
3230
3230
  let resultData = await LamdaServiceCall( LamdaURL, detectionPayload );
3231
3231
  if ( resultData ) {
3232
3232
  if ( resultData.status_code == '200' ) {
@@ -26,7 +26,6 @@ import * as teamsServices from '../services/teams.service.js';
26
26
  import * as runAIFeatureServices from '../services/runAIFeatures.services.js';
27
27
  import * as runAIRequestServices from '../services/runAIRequest.services.js';
28
28
  import * as processedTaskService from '../services/processedTaskList.service.js';
29
- import ExcelJS from 'exceljs';
30
29
 
31
30
 
32
31
  export const checklist = async ( req, res ) => {
@@ -184,7 +183,7 @@ export const create = async ( req, res ) => {
184
183
  checkNumber = result.length > 0 ? result[0].maxCheckListNumber + 1 : 0;
185
184
 
186
185
  let runAIQuestionCount = 0;
187
- let complianceCount = 0;
186
+
188
187
  inputBody.sections.forEach( async ( element ) => {
189
188
  if ( !element?.questions?.length && inputBody.submitType == 'configure' ) {
190
189
  return res.sendError( { message: 'Question is Required' }, 400 );
@@ -192,9 +191,6 @@ export const create = async ( req, res ) => {
192
191
  if ( element?.questions?.length ) {
193
192
  questionCount = questionCount + element?.questions?.length;
194
193
  }
195
- element.questions.forEach( ( question ) => {
196
- complianceCount += Math.max( ...question.answers.map( ( o ) => o?.complianceScore ?? Math.max( o?.matchedCount ?? 0, o?.notMatched ?? 0 ) ) );
197
- } );
198
194
  let runAiQuestions = element?.questions.filter( ( qn ) => qn.runAI );
199
195
  runAIQuestionCount += runAiQuestions.length;
200
196
  } );
@@ -210,7 +206,6 @@ export const create = async ( req, res ) => {
210
206
  client_id: req.body?.clientId,
211
207
  owner: req.user.userType == 'client' ? [ { name: req.user.userName, value: req.user.email } ] : [],
212
208
  runAIQuestionCount: runAIQuestionCount,
213
- complianceCount: complianceCount,
214
209
  // configStartDate:new Date(),
215
210
  // configEndDate:new Date(),
216
211
  };
@@ -987,7 +982,6 @@ export const update = async ( req, res ) => {
987
982
 
988
983
  let getExistQuestions = await questionService.findSort( { checkListId: req.params.checklistId, client_id: req.body.clientId }, {}, { sectionNumber: 1 } );
989
984
  let runAIQuestionCount = 0;
990
- let complianceCount = 0;
991
985
  inputBody.sections.forEach( async ( element ) => {
992
986
  if ( !element.questions.length && inputBody.submitType == 'configure' ) {
993
987
  return res.sendError( { message: 'Question is Required' }, 400 );
@@ -996,9 +990,6 @@ export const update = async ( req, res ) => {
996
990
  if ( element.questions.length ) {
997
991
  questionCount = questionCount + element.questions.length;
998
992
  }
999
- element.questions.forEach( ( question ) => {
1000
- complianceCount += Math.max( ...question.answers.map( ( o ) => o?.complianceScore ?? Math.max( o?.matchedCount ?? 0, o?.notMatched ?? 0 ) ) );
1001
- } );
1002
993
  let runAiQuestions = element?.questions.filter( ( qn ) => qn.runAI );
1003
994
  runAIQuestionCount += runAiQuestions.length;
1004
995
  } );
@@ -1009,7 +1000,6 @@ export const update = async ( req, res ) => {
1009
1000
  checkListDescription: inputBody.checklistDescription,
1010
1001
  questionCount: questionCount,
1011
1002
  runAIQuestionCount: runAIQuestionCount,
1012
- complianceCount: complianceCount,
1013
1003
  };
1014
1004
 
1015
1005
  await checklistService.updateOne( { _id: req.params.checklistId }, params );
@@ -3940,7 +3930,6 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
3940
3930
  element4.rawImageUpload = getCLconfig?.rawImageUpload || false;
3941
3931
  element4.rawVideoUpload = getCLconfig?.rawVideoUpload || false;
3942
3932
  element4.videoUploadTimeLimit = getCLconfig?.videoUploadTimeLimit || 0;
3943
- element4.complianceCount = getCLconfig?.complianceCount || 0;
3944
3933
  assignUserList.push( { ...element4 } );
3945
3934
  }
3946
3935
  } ) );
@@ -5086,71 +5075,3 @@ export async function updateOSProcessedData( req, res ) {
5086
5075
  return res.sendError( error, 500 );
5087
5076
  }
5088
5077
  }
5089
-
5090
- export async function downloadQuestionTemplate( req, res ) {
5091
- try {
5092
- let questionDetails = await questionService.find( { checkListId: req.body.checklistId } );
5093
- let answerType = {
5094
- 'descriptive': 'Descriptive Answer',
5095
- 'yes/no': 'A/B Question',
5096
- 'multiplechoicesingle': 'Multiple Choice Single',
5097
- 'multiplechoicemultiple': 'Multiple Choice Multiple',
5098
- 'descriptiveImage': 'Capture Image with Description',
5099
- 'image': 'Capture Image as answer',
5100
- 'video': 'Capture video as answer',
5101
- 'multipleImage': 'Capture Multiple Image',
5102
- 'date': 'Date',
5103
- 'linearscale': 'Linear Scale',
5104
- 'image/video': 'Capture Image/Video as Answer',
5105
- 'time': 'Time',
5106
- 'dropdown': 'Dropdown',
5107
- };
5108
- const workbook = new ExcelJS.Workbook();
5109
- const sheet = workbook.addWorksheet( 'Fixture Library' );
5110
-
5111
- sheet.getRow( 1 ).values = [ 'Section Name', 'Question', 'Answer Type', 'Answer Options' ];
5112
-
5113
- let rowStart = 2;
5114
-
5115
- questionDetails.forEach( ( section ) => {
5116
- section.question.forEach( ( qn ) => {
5117
- sheet.getRow( rowStart ).values = [ section.section, qn.qname, answerType[`${qn.answerType}`], [ 'multiplechoicesingle', 'multiplechoicemultiple', 'dropdown' ].includes( qn.answerType ) ? qn.answers.map( ( ans ) => ans.answer )?.toString() : '' ];
5118
- rowStart += 1;
5119
- } );
5120
- } );
5121
-
5122
-
5123
- const maxRows = 500000;
5124
-
5125
- let dropDownRange = [ { key: `C2:C${maxRows}`, optionList: [ '"Descriptive Answer,A/B Question,Multiple Choice Single,Multiple Choice Multiple,Capture Image with Description,Capture Image as answer,Capture video as answer,Capture Multiple Image,Date,Linear Scale,Capture Image/Video as Answer,Time,Dropdown,"' ] } ];
5126
-
5127
- dropDownRange.forEach( ( ele ) => {
5128
- sheet.dataValidations.add( ele.key, {
5129
- type: 'list',
5130
- allowBlank: true,
5131
- formulae: ele.optionList,
5132
- showErrorMessage: true,
5133
- errorTitle: 'Invalid Choice',
5134
- error: 'Please select from the dropdown list.',
5135
- } );
5136
- } );
5137
-
5138
- sheet.columns.forEach( ( column ) => {
5139
- let maxLength = 10;
5140
- column.eachCell( { includeEmpty: true }, ( cell ) => {
5141
- const cellValue = cell.value ? cell.value.toString() : '';
5142
- if ( cellValue.length > maxLength ) {
5143
- maxLength = cellValue.length;
5144
- }
5145
- } );
5146
- column.width = maxLength + 2;
5147
- } );
5148
- const buffer = await workbook.xlsx.writeBuffer();
5149
- res.setHeader( 'Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' );
5150
- res.setHeader( 'Content-Disposition', 'attachment; filename="Checklist Question.xlsx"' );
5151
- return res.send( buffer );
5152
- } catch ( e ) {
5153
- logger.error( { functionName: 'downloadQuestionTemplate', error: e } );
5154
- return res.sendError( e, 500 );
5155
- }
5156
- }
@@ -276,28 +276,6 @@ export const checklistPerformance = async ( req, res ) => {
276
276
  toDate = new Date( toDate.getTime() - userTimezoneOffset );
277
277
  toDate.setUTCHours( 23, 59, 59, 59 );
278
278
  let result = {};
279
- let checklistIdList = [];
280
-
281
- let limit = parseInt( requestData?.limit ) || 10;
282
- let skip = limit * ( requestData?.offset ) || 0;
283
-
284
- const detectionPayload = {
285
- 'fromDate': requestData.fromDate,
286
- 'toDate': requestData.toDate,
287
- 'clientId': requestData.clientId,
288
- 'sortColumnName': requestData.sortColumnName,
289
- 'sortBy': requestData.sortBy,
290
- 'storeId': requestData.storeId,
291
- };
292
-
293
-
294
- let complianceURL = 'https://h5gwudrwylz65s4vb6h2evwxeq0kkjog.lambda-url.ap-south-1.on.aws/';
295
- const complianceData = await LamdaServiceCall( complianceURL, detectionPayload );
296
- if ( complianceData?.data?.length && requestData?.sortColumnName == 'questionCompliance' ) {
297
- const end = skip + requestData?.limit;
298
- checklistIdList = complianceData.data.slice( skip, end )?.map( ( ele ) => ele?.sourceCheckList_id );
299
- }
300
-
301
279
 
302
280
  // Get User Based Checklist //
303
281
  // let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
@@ -314,10 +292,6 @@ export const checklistPerformance = async ( req, res ) => {
314
292
  { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
315
293
  );
316
294
 
317
- if ( requestData?.sortColumnName == 'questionCompliance' ) {
318
- findAndQuery.push( { sourceCheckList_id: { $in: checklistIdList } } );
319
- }
320
-
321
295
  findQuery.push( { $match: { $and: findAndQuery } } );
322
296
 
323
297
  if ( requestData.searchValue && requestData.searchValue != '' ) {
@@ -435,6 +409,9 @@ export const checklistPerformance = async ( req, res ) => {
435
409
  findQuery.push( { $sort: { ['submittedChecklist']: -1 } } );
436
410
  }
437
411
 
412
+ let limit = parseInt( requestData?.limit ) || 10;
413
+ let skip = limit * ( requestData?.offset ) || 0;
414
+
438
415
  findQuery.push( {
439
416
  $facet: {
440
417
  data: [
@@ -450,14 +427,6 @@ export const checklistPerformance = async ( req, res ) => {
450
427
  return res.sendError( 'no data found', 204 );
451
428
  }
452
429
 
453
- getChecklistPerformanceData?.[0]?.data.forEach( ( ele ) => {
454
- let findCompliance;
455
- if ( complianceData?.data?.length ) {
456
- findCompliance = complianceData?.data?.find( ( data ) => data.sourceCheckList_id == ele?.sourceCheckList_id );
457
- }
458
- ele['questionComplianceRate'] = findCompliance?.compliancePercentage ?? 0;
459
- } );
460
-
461
430
  if ( requestData.export ) {
462
431
  const exportdata = [];
463
432
  getChecklistPerformanceData[0].data.forEach( ( element ) => {
@@ -4334,27 +4303,3 @@ function escapeRegex( text ) {
4334
4303
  // return [ ];
4335
4304
  // }
4336
4305
  // }
4337
-
4338
- async function LamdaServiceCall( url, data ) {
4339
- try {
4340
- const requestOptions = {
4341
- method: 'POST',
4342
- headers: {
4343
- 'Content-Type': 'application/json',
4344
- },
4345
- body: JSON.stringify( data ),
4346
- };
4347
- console.log( data );
4348
- const response = await fetch( url, requestOptions );
4349
- if ( !response.ok ) {
4350
- throw new Error( `Response status: ${response.status}` );
4351
- return false;
4352
- }
4353
- const json = await response.json();
4354
- return json;
4355
- } catch ( error ) {
4356
- console.log( error );
4357
- logger.error( { error: error, message: data, function: 'LamdaServiceCall' } );
4358
- return false;
4359
- }
4360
- }