tango-app-api-trax 3.9.21 → 3.9.23
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
|
@@ -325,7 +325,7 @@ export async function PCLconfigCreation( req, res ) {
|
|
|
325
325
|
},
|
|
326
326
|
} );
|
|
327
327
|
let getSections = await CLquestions.aggregate( sectionQuery );
|
|
328
|
-
if ( getSections.length ||
|
|
328
|
+
if ( getSections.length || getCLconfig.checkListType != 'custom' ) {
|
|
329
329
|
if ( getSections.length ) {
|
|
330
330
|
for ( let element3 of getSections ) {
|
|
331
331
|
let collectQuestions = {};
|
|
@@ -651,11 +651,11 @@ export async function PCLconfigCreation( req, res ) {
|
|
|
651
651
|
// }
|
|
652
652
|
}
|
|
653
653
|
} else {
|
|
654
|
-
if (
|
|
654
|
+
if ( getCLconfig.checkListType != 'custom' ) {
|
|
655
655
|
let storeNameList = allQuestion.map( ( item ) => item.store_id );
|
|
656
|
-
let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...(
|
|
656
|
+
let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( getCLconfig.checkListType != 'custom' ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
|
|
657
657
|
let storeList = storeDetails.map( ( store ) => store.storeId );
|
|
658
|
-
if (
|
|
658
|
+
if ( getCLconfig.checkListType != 'custom' ) {
|
|
659
659
|
allQuestion = allQuestion.filter( ( ele ) => storeList.includes( ele?.store_id ) );
|
|
660
660
|
} else {
|
|
661
661
|
allQuestion = storeDetails.map( ( item ) => {
|
|
@@ -689,7 +689,7 @@ export async function PCLconfigCreation( req, res ) {
|
|
|
689
689
|
client_id: getCLconfig.client_id,
|
|
690
690
|
aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => store.store_id ) : [],
|
|
691
691
|
};
|
|
692
|
-
if (
|
|
692
|
+
if ( getCLconfig.checkListType != 'custom' ) {
|
|
693
693
|
let processData = {
|
|
694
694
|
aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => {
|
|
695
695
|
return { storeName: store.storeName, storeId: store.store_id, events: store.events };
|
|
@@ -1586,7 +1586,7 @@ export async function sopMobilechecklistMultiSectionFormatterv2( req, res, next
|
|
|
1586
1586
|
let CLQAnswers = getChecklistQA.questionAnswers;
|
|
1587
1587
|
|
|
1588
1588
|
if ( requestData.submittype == 'submit' ) {
|
|
1589
|
-
if ( getChecklistQA?.redoEdit ) {
|
|
1589
|
+
if ( getChecklistQA?.redoEdit?.toString() != requestData?.redoEdit ) {
|
|
1590
1590
|
requestData.submittype = 'draft';
|
|
1591
1591
|
}
|
|
1592
1592
|
reqAnswers.forEach( ( reqA ) => {
|
|
@@ -1677,6 +1677,7 @@ export async function sopMobilechecklistMultiSectionFormatterv2( req, res, next
|
|
|
1677
1677
|
let yn = [];
|
|
1678
1678
|
if ( ( getChecklistQA?.redoEdit && qaAnswers[j].redo == requestSection[i].redo ) || !getChecklistQA?.redoEdit ) {
|
|
1679
1679
|
for ( let k = 0; k < qaans.length; k++ ) {
|
|
1680
|
+
qaans[k].validationAnswer = '';
|
|
1680
1681
|
if ( requestSection[i].answer == qaans[k].answer ) {
|
|
1681
1682
|
if ( qaans[k].validationType == 'Capture Image' || qaans[k].validationType == 'Capture Video' ) {
|
|
1682
1683
|
if ( requestSection[i].validationAnswer ) {
|
|
@@ -1696,6 +1697,9 @@ export async function sopMobilechecklistMultiSectionFormatterv2( req, res, next
|
|
|
1696
1697
|
if ( requestSection[i]?.runAIData && requestSection[i]?.runAIData?.length ) {
|
|
1697
1698
|
qaans[k].runAIData = requestSection[i].runAIData;
|
|
1698
1699
|
}
|
|
1700
|
+
if ( requestSection[i]?.runAIAnswer ) {
|
|
1701
|
+
qaans[k].runAIAnswer = requestSection[i].runAIAnswer;
|
|
1702
|
+
}
|
|
1699
1703
|
yn.push( qaans[k] );
|
|
1700
1704
|
}
|
|
1701
1705
|
}
|
|
@@ -1737,6 +1741,7 @@ export async function sopMobilechecklistMultiSectionFormatterv2( req, res, next
|
|
|
1737
1741
|
};
|
|
1738
1742
|
structure.answers.forEach( ( ans ) => {
|
|
1739
1743
|
delete ans?.runAIData;
|
|
1744
|
+
delete ans?.runAIAnswer;
|
|
1740
1745
|
} );
|
|
1741
1746
|
newArray.push( structure );
|
|
1742
1747
|
} else if ( qaAnswers[j].answerType == 'multiplechoicesingle' || ( qaAnswers[j].answerType == 'dropdown' && !qaAnswers[j].allowMultiple ) ) {
|
|
@@ -1744,6 +1749,7 @@ export async function sopMobilechecklistMultiSectionFormatterv2( req, res, next
|
|
|
1744
1749
|
let ms = [];
|
|
1745
1750
|
if ( ( getChecklistQA?.redoEdit && qaAnswers[j].redo == requestSection[i].redo ) || !getChecklistQA?.redoEdit ) {
|
|
1746
1751
|
for ( let k = 0; k < qaans.length; k++ ) {
|
|
1752
|
+
qaans[k].validationAnswer = '';
|
|
1747
1753
|
if ( requestSection[i].answer == qaans[k].answer ) {
|
|
1748
1754
|
if ( qaans[k].validationType == 'Capture Image' || qaans[k].validationType == 'Capture Video' ) {
|
|
1749
1755
|
if ( requestSection[i].validationAnswer ) {
|
|
@@ -1778,6 +1784,9 @@ export async function sopMobilechecklistMultiSectionFormatterv2( req, res, next
|
|
|
1778
1784
|
if ( requestSection[i]?.runAIData && requestSection[i]?.runAIData?.length ) {
|
|
1779
1785
|
qaans[k].runAIData = requestSection[i].runAIData;
|
|
1780
1786
|
}
|
|
1787
|
+
if ( requestSection[i]?.runAIAnswer ) {
|
|
1788
|
+
qaans[k].runAIAnswer = requestSection[i].runAIAnswer;
|
|
1789
|
+
}
|
|
1781
1790
|
ms.push( qaans[k] );
|
|
1782
1791
|
}
|
|
1783
1792
|
}
|
|
@@ -1820,6 +1829,7 @@ export async function sopMobilechecklistMultiSectionFormatterv2( req, res, next
|
|
|
1820
1829
|
};
|
|
1821
1830
|
structure.answers.forEach( ( ans ) => {
|
|
1822
1831
|
delete ans?.runAIData;
|
|
1832
|
+
delete ans?.runAIAnswer;
|
|
1823
1833
|
} );
|
|
1824
1834
|
newArray.push( structure );
|
|
1825
1835
|
} else if ( qaAnswers[j].answerType == 'multiplechoicemultiple' || ( qaAnswers[j].answerType == 'dropdown' && qaAnswers[j].allowMultiple ) ) {
|
|
@@ -1827,6 +1837,7 @@ export async function sopMobilechecklistMultiSectionFormatterv2( req, res, next
|
|
|
1827
1837
|
let mcmo = [];
|
|
1828
1838
|
if ( ( getChecklistQA?.redoEdit && qaAnswers[j].redo == requestSection[i].redo ) || !getChecklistQA?.redoEdit || ( getChecklistQA?.redoEdit && qaAnswers[j].answers.some( ( ans ) => ans.redo ) ) ) {
|
|
1829
1839
|
for ( let k = 0; k < qaans.length; k++ ) {
|
|
1840
|
+
qaans[k].validationAnswer = '';
|
|
1830
1841
|
let separatedArray = typeof requestSection[i].Multianswer == 'string' ? JSON.parse( requestSection[i].Multianswer ) : requestSection[i].Multianswer;
|
|
1831
1842
|
for ( let s = 0; s < separatedArray.length; s++ ) {
|
|
1832
1843
|
if ( ( separatedArray[s].answer == qaans[k].answer ) ) {
|
|
@@ -1849,6 +1860,9 @@ export async function sopMobilechecklistMultiSectionFormatterv2( req, res, next
|
|
|
1849
1860
|
if ( separatedArray[s]?.runAIData && separatedArray[s]?.runAIData?.length ) {
|
|
1850
1861
|
qaans[k].runAIData = separatedArray[s].runAIData;
|
|
1851
1862
|
}
|
|
1863
|
+
if ( separatedArray[s]?.runAIAnswer ) {
|
|
1864
|
+
qaans[k].runAIAnswer = separatedArray[s].runAIAnswer;
|
|
1865
|
+
}
|
|
1852
1866
|
mcmo.push( qaans[k] );
|
|
1853
1867
|
}
|
|
1854
1868
|
}
|
|
@@ -1899,6 +1913,7 @@ export async function sopMobilechecklistMultiSectionFormatterv2( req, res, next
|
|
|
1899
1913
|
};
|
|
1900
1914
|
structure.answers.forEach( ( ans ) => {
|
|
1901
1915
|
delete ans?.runAIData;
|
|
1916
|
+
delete ans?.runAIAnswer;
|
|
1902
1917
|
} );
|
|
1903
1918
|
newArray.push( structure );
|
|
1904
1919
|
} else if ( [ 'image/video', 'multipleImage' ].includes( qaAnswers[j].answerType ) ) {
|
|
@@ -1938,6 +1953,9 @@ export async function sopMobilechecklistMultiSectionFormatterv2( req, res, next
|
|
|
1938
1953
|
if ( separatedArray[s]?.runAIData && separatedArray[s]?.runAIData?.length ) {
|
|
1939
1954
|
newAnswer.runAIData = separatedArray[s].runAIData;
|
|
1940
1955
|
}
|
|
1956
|
+
if ( separatedArray[s]?.runAIAnswer ) {
|
|
1957
|
+
newAnswer.runAIAnswer = separatedArray[s].runAIAnswer;
|
|
1958
|
+
}
|
|
1941
1959
|
mcmi.push( newAnswer );
|
|
1942
1960
|
}
|
|
1943
1961
|
}
|
|
@@ -2049,6 +2067,9 @@ export async function sopMobilechecklistMultiSectionFormatterv2( req, res, next
|
|
|
2049
2067
|
if ( requestSection[i]?.runAIData && requestSection[i]?.runAIData?.length ) {
|
|
2050
2068
|
ansstructure.runAIData = requestSection[i].runAIData;
|
|
2051
2069
|
}
|
|
2070
|
+
if ( requestSection[i]?.runAIAnswer ) {
|
|
2071
|
+
ansstructure.runAIAnswer = requestSection[i].runAIAnswer;
|
|
2072
|
+
}
|
|
2052
2073
|
des.push( ansstructure );
|
|
2053
2074
|
}
|
|
2054
2075
|
}
|
|
@@ -2884,7 +2905,7 @@ export async function submitChecklist( req, res ) {
|
|
|
2884
2905
|
}
|
|
2885
2906
|
}
|
|
2886
2907
|
}
|
|
2887
|
-
if ( getchecklist?.[0]?.redoEdit ) {
|
|
2908
|
+
if ( getchecklist?.[0]?.redoEdit?.toString() != requestData?.redoEdit ) {
|
|
2888
2909
|
return res.sendSuccess( 'New Questions Added So,Checklist moved back to In Progress. Please complete the updated checklist.' );
|
|
2889
2910
|
} else {
|
|
2890
2911
|
return res.sendSuccess( 'Checklist Updated Successfully' );
|
|
@@ -4155,6 +4176,7 @@ export async function questionList( req, res ) {
|
|
|
4155
4176
|
taskType: { $ifNull: [ '$planoType', '' ] },
|
|
4156
4177
|
streamId: { $ifNull: [ '$streamId', '' ] },
|
|
4157
4178
|
export: { $ifNull: [ '$export', false ] },
|
|
4179
|
+
redoEdit: 1,
|
|
4158
4180
|
},
|
|
4159
4181
|
} );
|
|
4160
4182
|
|
|
@@ -2747,7 +2747,7 @@ export const checklistDropdownV1 = async ( req, res ) => {
|
|
|
2747
2747
|
$or: [
|
|
2748
2748
|
{ questionFlag: { $gte: 1 } },
|
|
2749
2749
|
{ timeFlag: { $gte: 1 } },
|
|
2750
|
-
{ checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection' ] } },
|
|
2750
|
+
{ checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection', 'vehicle_check_in' ] } },
|
|
2751
2751
|
{
|
|
2752
2752
|
runAIQuestionCount: { $gte: 1 },
|
|
2753
2753
|
},
|
|
@@ -3051,7 +3051,7 @@ export const flagTablesV2 = async ( req, res ) => {
|
|
|
3051
3051
|
}
|
|
3052
3052
|
|
|
3053
3053
|
if ( requestData?.filter === 'all' ) {
|
|
3054
|
-
findAndQuery.push( { $or: [ { checkListType: { $in: [ 'custom', 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection' ] } } ] } );
|
|
3054
|
+
findAndQuery.push( { $or: [ { checkListType: { $in: [ 'custom', 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection', 'vehicle_check_in' ] } } ] } );
|
|
3055
3055
|
} else if ( requestData?.filter === 'question' ) {
|
|
3056
3056
|
findAndQuery.push( { checkListType: 'custom' } );
|
|
3057
3057
|
findAndQuery.push( { questionFlag: { $gte: 1 } } );
|
|
@@ -3059,7 +3059,7 @@ export const flagTablesV2 = async ( req, res ) => {
|
|
|
3059
3059
|
findAndQuery.push( { checkListType: 'custom' } );
|
|
3060
3060
|
findAndQuery.push( { timeFlag: { $gte: 1 } } );
|
|
3061
3061
|
} else if ( requestData?.filter === 'detection' ) {
|
|
3062
|
-
findAndQuery.push( { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection' ] } } );
|
|
3062
|
+
findAndQuery.push( { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'storehygienemonitoring', 'unattendeddetection', 'vehicle_check_in' ] } } );
|
|
3063
3063
|
} else if ( requestData?.filter === 'runAI' ) {
|
|
3064
3064
|
if ( req.body.runAIChecklistName ) {
|
|
3065
3065
|
findAndQuery.push( { checkListName: { $in: req.body.runAIChecklistName } } );
|
|
@@ -3200,6 +3200,7 @@ export const flagTablesV2 = async ( req, res ) => {
|
|
|
3200
3200
|
} );
|
|
3201
3201
|
|
|
3202
3202
|
let getTotalCount = await processedchecklistService.aggregate( findQuery );
|
|
3203
|
+
console.log( getTotalCount );
|
|
3203
3204
|
if ( !getTotalCount.length ) {
|
|
3204
3205
|
return res.sendError( { error: 'No Data Found' }, 204 );
|
|
3205
3206
|
}
|
|
@@ -614,6 +614,8 @@ export const zoneList = async ( req, res ) => {
|
|
|
614
614
|
'Employee Count Detection',
|
|
615
615
|
'Staff Grouping Compliance',
|
|
616
616
|
'Retail Shelf Monitoring',
|
|
617
|
+
'Store Mopping Compliance Checklist',
|
|
618
|
+
'Occupancy Detection',
|
|
617
619
|
];
|
|
618
620
|
const allowedChecklistsStreams = [
|
|
619
621
|
'Camera Angle Change Compliance',
|
|
@@ -4134,7 +4136,7 @@ async function updateOpenSearch( user, data ) {
|
|
|
4134
4136
|
export const aiChecklist = async ( req, res ) => {
|
|
4135
4137
|
try {
|
|
4136
4138
|
let storeDetails = await storeService.count( { clientId: req.query.clientId, status: 'active' } );
|
|
4137
|
-
let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection' ];
|
|
4139
|
+
let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'occupancydetection' ];
|
|
4138
4140
|
let checklistDetails = [];
|
|
4139
4141
|
let publishList = [];
|
|
4140
4142
|
let unpublishList = [];
|