tango-app-api-trax 3.3.1-beta-67 → 3.3.1-beta-69
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 +2 -2
- package/src/controllers/gallery.controller.js +2 -2
- package/src/controllers/mobileTrax.controller.js +9 -55
- package/src/controllers/teaxFlag.controller.js +6 -5
- package/src/controllers/trax.controller.js +1 -1
- package/src/controllers/traxDashboard.controllers.js +5 -1
- package/src/hbs/login-otp.hbs +943 -943
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-trax",
|
|
3
|
-
"version": "3.3.1-beta-
|
|
3
|
+
"version": "3.3.1-beta-69",
|
|
4
4
|
"description": "Trax",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"start": "nodemon --exec \"eslint --fix . && node
|
|
8
|
+
"start": "nodemon --exec \"eslint --fix . && node index.js\""
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=18.10.0"
|
|
@@ -362,14 +362,14 @@ export async function redoChecklist( req, res ) {
|
|
|
362
362
|
return res.sendError( 'section is not found', 400 );
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
let findQuestion = question[sectionIndex].questions.findIndex( ( ele ) => ele
|
|
365
|
+
let findQuestion = question[sectionIndex].questions.findIndex( ( ele ) => ele.qno == req.body.payload.qno );
|
|
366
366
|
|
|
367
367
|
let data = { ...question[sectionIndex].questions[findQuestion], redo: true, redoComment: req.body.payload?.checklistDescription || '' };
|
|
368
368
|
// if ( checklistDetails.client_id == '458' ) {
|
|
369
369
|
data.answers.forEach( ( item ) => {
|
|
370
370
|
if ( item.showLinked ) {
|
|
371
371
|
item.nestedQuestion.forEach( ( ele ) => {
|
|
372
|
-
let eleIndex = question[sectionIndex].questions.findIndex( ( qn ) => qn
|
|
372
|
+
let eleIndex = question[sectionIndex].questions.findIndex( ( qn ) => qn.qno == parseInt( ele ) );
|
|
373
373
|
let element = { ...question[sectionIndex].questions[eleIndex], redo: true, redoComment: '', linkquestionenabled: false };
|
|
374
374
|
question[sectionIndex].questions[eleIndex] = element;
|
|
375
375
|
question[sectionIndex].questions[eleIndex].userAnswer = [];
|
|
@@ -234,45 +234,18 @@ export async function startChecklist( req, res ) {
|
|
|
234
234
|
await checklistLogs.create( logInsertData );
|
|
235
235
|
let getchecklist = getupdatedchecklist;
|
|
236
236
|
let questions = [];
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
questions = [];
|
|
240
|
-
for ( let question of section.questions ) {
|
|
241
|
-
if ( !question.linkType ) {
|
|
242
|
-
question.parentQuestion = question.qno;
|
|
243
|
-
questions.push( question );
|
|
244
|
-
let linkedAnswer = new Set( question.answers.filter( ( ele ) => ele.showLinked ).flatMap( ( ele ) => ele.nestedQuestion ) );
|
|
245
|
-
let linkedQuestion = section.questions.filter( ( qn ) => qn?.parentQuestion ? qn?.parentQuestion == question.qno && linkedAnswer.has( qn.qno ) : linkedAnswer.has( qn.qno ) );
|
|
246
|
-
linkedQuestion = JSON.parse( JSON.stringify( linkedQuestion ) );
|
|
247
|
-
linkedQuestion.forEach( ( linkQn ) => {
|
|
248
|
-
linkQn.parentQuestion = question.qno;
|
|
249
|
-
} );
|
|
250
|
-
questions.push( ...linkedQuestion );
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
getchecklist[index].questionAnswers[secIndex].questions = questions;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
function processQuestion( question, section, questions, nested = false ) {
|
|
257
|
-
let findExists = questions.find( ( item ) => item?.qno && item.qno == question.qno && item.parentQuestion == question.parentQuestion );
|
|
237
|
+
function processQuestion( question, section, questions, nested=false ) {
|
|
238
|
+
let findExists = questions.find( ( item ) => item?.qno && item.qno == question.qno );
|
|
258
239
|
if ( findExists && nested ) {
|
|
259
|
-
let findIndex = questions.findIndex( ( item ) => item?.qno && item.qno == question.qno
|
|
240
|
+
let findIndex = questions.findIndex( ( item ) => item?.qno && item.qno == question.qno );
|
|
260
241
|
questions.splice( findIndex, 1 );
|
|
261
242
|
questions.push( question );
|
|
262
|
-
for ( let answer of question.answers ) {
|
|
263
|
-
if ( answer.showLinked && answer?.linkedQuestion != '' ) {
|
|
264
|
-
let linkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion && item.parentQuestion == question.parentQuestion );
|
|
265
|
-
if ( linkedQuestion ) {
|
|
266
|
-
processQuestion( linkedQuestion, section, questions, true );
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
243
|
}
|
|
271
244
|
if ( !findExists ) {
|
|
272
245
|
questions.push( question );
|
|
273
246
|
for ( let answer of question.answers ) {
|
|
274
247
|
if ( answer.showLinked && answer?.linkedQuestion != '' ) {
|
|
275
|
-
let linkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion
|
|
248
|
+
let linkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion );
|
|
276
249
|
if ( linkedQuestion ) {
|
|
277
250
|
processQuestion( linkedQuestion, section, questions, true );
|
|
278
251
|
}
|
|
@@ -2669,34 +2642,15 @@ export async function questionList( req, res ) {
|
|
|
2669
2642
|
}
|
|
2670
2643
|
|
|
2671
2644
|
let questions = [];
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
questions = [];
|
|
2675
|
-
for ( let question of section.questions ) {
|
|
2676
|
-
if ( !question.linkType ) {
|
|
2677
|
-
question.parentQuestion = question.qno;
|
|
2678
|
-
questions.push( question );
|
|
2679
|
-
let linkedAnswer = new Set( question.answers.filter( ( ele ) => ele.showLinked ).flatMap( ( ele ) => ele.nestedQuestion ) );
|
|
2680
|
-
let linkedQuestion = section.questions.filter( ( qn ) => qn?.parentQuestion ? qn?.parentQuestion == question.qno && linkedAnswer.has( qn.qno ) : linkedAnswer.has( qn.qno ) );
|
|
2681
|
-
linkedQuestion = JSON.parse( JSON.stringify( linkedQuestion ) );
|
|
2682
|
-
linkedQuestion.forEach( ( linkQn ) => {
|
|
2683
|
-
linkQn.parentQuestion = question.qno;
|
|
2684
|
-
} );
|
|
2685
|
-
questions.push( ...linkedQuestion );
|
|
2686
|
-
}
|
|
2687
|
-
}
|
|
2688
|
-
getchecklist[index].questionAnswers[secIndex].questions = questions;
|
|
2689
|
-
}
|
|
2690
|
-
}
|
|
2691
|
-
function processQuestion( question, section, questions, nested = false ) {
|
|
2692
|
-
let findExists = questions.find( ( item ) => item?.qno && item.qno == question.qno && item.parentQuestion == question.parentQuestion );
|
|
2645
|
+
function processQuestion( question, section, questions, nested=false ) {
|
|
2646
|
+
let findExists = questions.find( ( item ) => item?.qno && item.qno == question.qno );
|
|
2693
2647
|
if ( findExists && nested ) {
|
|
2694
|
-
let findIndex = questions.findIndex( ( item ) => item?.qno && item.qno == question.qno
|
|
2648
|
+
let findIndex = questions.findIndex( ( item ) => item?.qno && item.qno == question.qno );
|
|
2695
2649
|
questions.splice( findIndex, 1 );
|
|
2696
2650
|
questions.push( question );
|
|
2697
2651
|
for ( let answer of question.answers ) {
|
|
2698
2652
|
if ( answer.showLinked && answer?.linkedQuestion != '' ) {
|
|
2699
|
-
let linkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion
|
|
2653
|
+
let linkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion );
|
|
2700
2654
|
if ( linkedQuestion ) {
|
|
2701
2655
|
processQuestion( linkedQuestion, section, questions, true );
|
|
2702
2656
|
}
|
|
@@ -2707,7 +2661,7 @@ export async function questionList( req, res ) {
|
|
|
2707
2661
|
questions.push( question );
|
|
2708
2662
|
for ( let answer of question.answers ) {
|
|
2709
2663
|
if ( answer.showLinked && answer?.linkedQuestion != '' ) {
|
|
2710
|
-
let linkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion
|
|
2664
|
+
let linkedQuestion = section.questions.find( ( item ) => item.qno == answer.linkedQuestion );
|
|
2711
2665
|
if ( linkedQuestion ) {
|
|
2712
2666
|
processQuestion( linkedQuestion, section, questions, true );
|
|
2713
2667
|
}
|
|
@@ -1048,10 +1048,11 @@ export const flagTablesV1 = async ( req, res ) => {
|
|
|
1048
1048
|
const data = {
|
|
1049
1049
|
'Checklist Name': element.checkListName,
|
|
1050
1050
|
'Flag Type': element?.checkListType === 'custom' ? 'Question' : 'Detection',
|
|
1051
|
+
'coverage': element.coverage,
|
|
1051
1052
|
'Assigned Stores': element?.assignedStores,
|
|
1052
1053
|
'Flagged Stores': element?.flaggedStores,
|
|
1053
1054
|
'Compliance': element?.complianceRate,
|
|
1054
|
-
'Flagged Count': element?.flagCount,
|
|
1055
|
+
// 'Flagged Count': element?.flagCount,
|
|
1055
1056
|
'Question Flags': element?.customQuestionFlagCount,
|
|
1056
1057
|
'Not Submitted Flags': element?.customTimeFlagCount,
|
|
1057
1058
|
};
|
|
@@ -2445,10 +2446,10 @@ export const flagChecklistTableV1 = async ( req, res ) => {
|
|
|
2445
2446
|
total.forEach( ( element ) => {
|
|
2446
2447
|
exportdata.push( {
|
|
2447
2448
|
'Date': dayjs( element.dateString ).format( 'DD MMM, YYYY' ),
|
|
2448
|
-
'Store Name': element?.storeName,
|
|
2449
|
-
'Store Id': element?.storeId,
|
|
2450
|
-
'
|
|
2451
|
-
'
|
|
2449
|
+
'Store Name': element?.storeName?element?.storeName:'--',
|
|
2450
|
+
'Store Id': element?.storeId?element?.storeId:'--',
|
|
2451
|
+
'User Email': element?.storeSpocEmail,
|
|
2452
|
+
'No. of flags': element?.detections,
|
|
2452
2453
|
} );
|
|
2453
2454
|
} );
|
|
2454
2455
|
return await download( exportdata, res );
|
|
@@ -3692,7 +3692,7 @@ export async function checklistAssign( req, res ) {
|
|
|
3692
3692
|
clientId: req.body.clientId,
|
|
3693
3693
|
};
|
|
3694
3694
|
let uploadData = await assignUsers( assignedData );
|
|
3695
|
-
if ( uploadData
|
|
3695
|
+
if ( uploadData?.length ) {
|
|
3696
3696
|
uniqueArr.push( ...uploadData );
|
|
3697
3697
|
}
|
|
3698
3698
|
} ) );
|
|
@@ -1283,7 +1283,7 @@ export const checklistInfo = async ( req, res ) => {
|
|
|
1283
1283
|
userName: 1,
|
|
1284
1284
|
userEmail: '$_id.email',
|
|
1285
1285
|
checklistStatus: 1,
|
|
1286
|
-
submitTime_string: { $arrayElemAt: [ '$submitTime_string',
|
|
1286
|
+
submitTime_string: { $arrayElemAt: [ '$submitTime_string', 0 ] },
|
|
1287
1287
|
storeName: 1,
|
|
1288
1288
|
checkListType: 1,
|
|
1289
1289
|
scheduleRepeatedType: 1,
|
|
@@ -1380,6 +1380,10 @@ export const checklistInfo = async ( req, res ) => {
|
|
|
1380
1380
|
totalCount: getChecklistPerformanceData?.[0]?.count?.[0]?.total || 0,
|
|
1381
1381
|
checklistInfo: getChecklistPerformanceData?.[0]?.data || [],
|
|
1382
1382
|
};
|
|
1383
|
+
|
|
1384
|
+
result.checklistInfo.forEach( ( item ) => {
|
|
1385
|
+
item.date_string = dayjs( item.date_string, 'YYYY-MM-DD' ).format( 'DD MMM YYYY' );
|
|
1386
|
+
} );
|
|
1383
1387
|
if ( requestData.export ) {
|
|
1384
1388
|
const exportdata = [];
|
|
1385
1389
|
result.checklistInfo.forEach( ( element ) => {
|