tango-app-api-trax 3.7.68 → 3.7.70
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.7.
|
|
3
|
+
"version": "3.7.70",
|
|
4
4
|
"description": "Trax",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"nodemon": "^3.1.4",
|
|
30
30
|
"path": "^0.12.7",
|
|
31
31
|
"puppeteer": "^24.39.1",
|
|
32
|
-
"tango-api-schema": "^2.5.
|
|
32
|
+
"tango-api-schema": "^2.5.64",
|
|
33
33
|
"tango-app-api-middleware": "^3.5.2",
|
|
34
34
|
"url": "^0.11.4",
|
|
35
35
|
"winston": "^3.13.1",
|
|
@@ -1444,9 +1444,26 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
|
|
|
1444
1444
|
};
|
|
1445
1445
|
if ( qaAnswers[j].answerType == 'date' ) {
|
|
1446
1446
|
ansstructure.dateRangeType = requestSection[i].dateRangeType || false;
|
|
1447
|
+
if ( qaAnswers[j].compliance ) {
|
|
1448
|
+
// if( requestSection[i].answer > )
|
|
1449
|
+
}
|
|
1447
1450
|
}
|
|
1448
1451
|
if ( qaAnswers[j].answerType == 'linearscale' ) {
|
|
1452
|
+
let linearAnswer = requestSection[i].answer.split( 'to' );
|
|
1453
|
+
if ( qaAnswers[j].compliance ) {
|
|
1454
|
+
if ( parseInt( linearAnswer?.[0] ) >= qaAnswers[j]?.answers[0]?.minValue && parseInt( linearAnswer?.[1] ) <= qaAnswers[j]?.answers[0]?.maxValue ) {
|
|
1455
|
+
ansstructure.complianceScore = qaAnswers[j]?.answers[0]?.matchedCount;
|
|
1456
|
+
} else {
|
|
1457
|
+
ansstructure.complianceScore = qaAnswers[j]?.answers[0]?.notMatchedCount;
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1449
1460
|
ansstructure.linearType = qaAnswers[j]?.answers[0]?.linearType;
|
|
1461
|
+
ansstructure.matchedCount = qaAnswers[j]?.answers[0]?.matchedCount;
|
|
1462
|
+
ansstructure.notMatchedCount = qaAnswers[j]?.answers[0]?.notMatchedCount;
|
|
1463
|
+
}
|
|
1464
|
+
if ( qaAnswers[j].answerType == 'image' ) {
|
|
1465
|
+
ansstructure.matchedCount = qaAnswers[j]?.answers[0]?.matchedCount;
|
|
1466
|
+
ansstructure.notMatchedCount = qaAnswers[j]?.answers[0]?.notMatchedCount;
|
|
1450
1467
|
}
|
|
1451
1468
|
des.push( ansstructure );
|
|
1452
1469
|
}
|
|
@@ -2013,7 +2030,6 @@ export async function submitChecklist( req, res ) {
|
|
|
2013
2030
|
logDetails: {},
|
|
2014
2031
|
userType: req.user.userType,
|
|
2015
2032
|
};
|
|
2016
|
-
console.log( 'inserttraxlogs =>', inserttraxlogs );
|
|
2017
2033
|
insertOpenSearchData( openSearch.traxActivityLog, inserttraxlogs );
|
|
2018
2034
|
if ( updateData.questionFlag ) {
|
|
2019
2035
|
let checklistDetails = await checklistService.findOne( { _id: getchecklist[0].sourceCheckList_id }, { notifyFlags: 1, approver: 1 } );
|
|
@@ -2023,7 +2039,7 @@ export async function submitChecklist( req, res ) {
|
|
|
2023
2039
|
let data = {
|
|
2024
2040
|
storeName: getchecklist[0].storeName,
|
|
2025
2041
|
flagCount: updateData.questionFlag,
|
|
2026
|
-
checklistName: getchecklist[0].checkListName
|
|
2042
|
+
checklistName: getchecklist[0].checkListName,
|
|
2027
2043
|
submittedBy: getchecklist[0].userName,
|
|
2028
2044
|
time: updateData.submitMobileTime,
|
|
2029
2045
|
domain: `${JSON.parse( process.env.URL ).domain}/manage/trax/flags`,
|
|
@@ -3705,10 +3721,14 @@ export async function taskQuestionList( req, res ) {
|
|
|
3705
3721
|
}
|
|
3706
3722
|
}
|
|
3707
3723
|
|
|
3708
|
-
if ( question.answerType == 'multiplechoicemultiple' ) {
|
|
3724
|
+
if ( question.answerType == 'multiplechoicemultiple' || ( question.answerType == 'dropdown' && question.allowMultiple ) ) {
|
|
3709
3725
|
let checkvalidation = null;
|
|
3710
3726
|
if ( answer.validationAnswer && answer.validationAnswer != '' ) {
|
|
3711
|
-
|
|
3727
|
+
if ( answer.validationType != 'Descriptive Answer' ) {
|
|
3728
|
+
checkvalidation = await signedUrl( { file_path: decodeURIComponent( answer.validationAnswer ), Bucket: bucket.sop } );
|
|
3729
|
+
} else {
|
|
3730
|
+
checkvalidation = answer.validationAnswer;
|
|
3731
|
+
}
|
|
3712
3732
|
}
|
|
3713
3733
|
Multianswer.push( { 'answer': answer.answer, 'no': ansIndex, 'validationAnswer': checkvalidation } );
|
|
3714
3734
|
getchecklist[0].questionAnswers[secIndex].questions[questionIndex].answers[ansIndex].index = ansIndex;
|
|
@@ -3729,7 +3749,7 @@ export async function taskQuestionList( req, res ) {
|
|
|
3729
3749
|
Bucket: bucket.sop,
|
|
3730
3750
|
} );
|
|
3731
3751
|
}
|
|
3732
|
-
if ( [ 'image', 'descriptiveImage', 'video' ].includes( question.answerType ) && userAns.answer != '' ) {
|
|
3752
|
+
if ( [ 'image', 'descriptiveImage', 'video', 'image/video' ].includes( question.answerType ) && userAns.answer != '' ) {
|
|
3733
3753
|
getchecklist[0].questionAnswers[secIndex].questions[questionIndex].userAnswer[userAnsIndex].answer = await signedUrl( {
|
|
3734
3754
|
file_path: decodeURIComponent( userAns.answer ),
|
|
3735
3755
|
Bucket: bucket.sop,
|
|
@@ -3741,23 +3761,23 @@ export async function taskQuestionList( req, res ) {
|
|
|
3741
3761
|
Bucket: bucket.sop,
|
|
3742
3762
|
} );
|
|
3743
3763
|
}
|
|
3744
|
-
if ( question.answerType == 'multiplechoicemultiple' ) {
|
|
3764
|
+
if ( question.answerType == 'multiplechoicemultiple' || ( question.answerType == 'dropdown' && question.allowMultiple ) ) {
|
|
3745
3765
|
let ansIndex = Multianswer.findIndex( ( item ) => item.answer == userAns.answer );
|
|
3746
|
-
if ( ansIndex ) {
|
|
3766
|
+
if ( ansIndex >= 0 ) {
|
|
3747
3767
|
Multianswer[ansIndex].validationAnswer = userAns.validationAnswer;
|
|
3748
3768
|
}
|
|
3749
3769
|
}
|
|
3750
|
-
if ( question.answerType == 'multipleImage' ) {
|
|
3770
|
+
if ( question.answerType == 'multipleImage' || question.answerType == 'image/video' ) {
|
|
3751
3771
|
if ( userAns && userAns.answer && userAns.answer != '' ) {
|
|
3752
3772
|
let manswer = await signedUrl( { file_path: decodeURIComponent( userAns.answer ), Bucket: bucket.sop } );
|
|
3753
|
-
Multianswer.push( { 'answer': manswer, 'no': userAnsIndex, 'validationAnswer': '' } );
|
|
3773
|
+
Multianswer.push( { 'answer': manswer, 'no': userAnsIndex, 'validationAnswer': '', ...( question.answerType == 'image/video' && { answerType: userAns?.answerType } ) } );
|
|
3754
3774
|
} else {
|
|
3755
3775
|
|
|
3756
3776
|
}
|
|
3757
3777
|
}
|
|
3758
3778
|
}
|
|
3759
3779
|
}
|
|
3760
|
-
if ( question.answerType == 'multiplechoicemultiple' ) {
|
|
3780
|
+
if ( question.answerType == 'multiplechoicemultiple' || ( question.answerType == 'dropdown' && question.allowMultiple ) ) {
|
|
3761
3781
|
Multianswer.forEach( ( item ) => {
|
|
3762
3782
|
if ( item.validationAnswer == null ) {
|
|
3763
3783
|
item.answer = null;
|
|
@@ -3769,11 +3789,11 @@ export async function taskQuestionList( req, res ) {
|
|
|
3769
3789
|
question.Multianswer = Multianswer;
|
|
3770
3790
|
}
|
|
3771
3791
|
}
|
|
3772
|
-
if ( question.answerType == 'multipleImage' ) {
|
|
3792
|
+
if ( question.answerType == 'multipleImage' || question.answerType == 'image/video' ) {
|
|
3773
3793
|
if ( Multianswer.length ) {
|
|
3774
3794
|
question.Multianswer = Multianswer;
|
|
3775
3795
|
} else {
|
|
3776
|
-
Multianswer.push( { 'answer': null, 'no': 0, 'validationAnswer': null } );
|
|
3796
|
+
Multianswer.push( { 'answer': null, 'no': 0, 'validationAnswer': null, ...( question.answerType == 'image/video' && { answerType: null } ) } );
|
|
3777
3797
|
question.Multianswer = Multianswer;
|
|
3778
3798
|
}
|
|
3779
3799
|
}
|
|
@@ -446,7 +446,6 @@ export const checklistPerformance = async ( req, res ) => {
|
|
|
446
446
|
},
|
|
447
447
|
} );
|
|
448
448
|
let getChecklistPerformanceData = await processedchecklistService.aggregate( findQuery );
|
|
449
|
-
console.log( getChecklistPerformanceData );
|
|
450
449
|
if ( !getChecklistPerformanceData[0].data.length ) {
|
|
451
450
|
return res.sendError( 'no data found', 204 );
|
|
452
451
|
}
|