tango-app-api-trax 3.3.1-beta-66 → 3.3.1-beta-68
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
|
@@ -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
|
}
|
|
@@ -3240,6 +3240,7 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
|
|
|
3240
3240
|
element4.approvalEnable = getCLconfig.approver.length ? true : false;
|
|
3241
3241
|
element4.remainder = getCLconfig?.remainder || [];
|
|
3242
3242
|
element4.restrictAttendance = getCLconfig?.restrictAttendance;
|
|
3243
|
+
element4.coverage = getCLconfig?.coverage;
|
|
3243
3244
|
assignUserList.push( { ...element4 } );
|
|
3244
3245
|
}
|
|
3245
3246
|
} ) );
|
|
@@ -3691,7 +3692,7 @@ export async function checklistAssign( req, res ) {
|
|
|
3691
3692
|
clientId: req.body.clientId,
|
|
3692
3693
|
};
|
|
3693
3694
|
let uploadData = await assignUsers( assignedData );
|
|
3694
|
-
if ( uploadData
|
|
3695
|
+
if ( uploadData?.length ) {
|
|
3695
3696
|
uniqueArr.push( ...uploadData );
|
|
3696
3697
|
}
|
|
3697
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 ) => {
|