tango-app-api-trax 3.7.80 → 3.7.82
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
|
@@ -1372,7 +1372,7 @@ export async function insertTimeDelayFlags( req, res ) {
|
|
|
1372
1372
|
|
|
1373
1373
|
if ( notifyStores.length ) {
|
|
1374
1374
|
Promise.all( notifyStores.map( async ( store ) => {
|
|
1375
|
-
let checklistDetails = await
|
|
1375
|
+
let checklistDetails = await CLconfig.findOne( { _id: store.sourceCheckList_id }, { notifyFlags: 1, approver: 1 } );
|
|
1376
1376
|
if ( checklistDetails?.notifyFlags?.notifyType?.length ) {
|
|
1377
1377
|
let emailList = checklistDetails?.notifyFlags?.notifyType.includes( 'approver' ) ? checklistDetails.approver.map( ( ele ) => ele?.value ): [];
|
|
1378
1378
|
emailList = [ ...emailList, ...checklistDetails?.notifyFlags?.users?.map( ( ele ) => ele?.value ) ];
|
|
@@ -3375,7 +3375,6 @@ export async function getStoreTaskDetails( req, res ) {
|
|
|
3375
3375
|
export async function runAIFlag( req, res ) {
|
|
3376
3376
|
try {
|
|
3377
3377
|
let checklistDetails = await CLconfig.find( { publish: true, $expr: { $ne: [ { $size: '$notifyFlags.notifyType' }, 0 ] }, runAIQuestionCount: { $ne: 0 } }, { _id: 1, notifyFlags: 1, approver: 1 } );
|
|
3378
|
-
console.log( checklistDetails, 'checklistDetails' );
|
|
3379
3378
|
if ( checklistDetails.length ) {
|
|
3380
3379
|
await Promise.all( checklistDetails.map( async ( ele ) => {
|
|
3381
3380
|
let submitDetails = await processedchecklist.find( { sourceCheckList_id: ele._id, checklistStatus: 'submit' }, { storeName: 1, checkListName: 1, questionAnswers: 1 } );
|
|
@@ -3384,12 +3383,11 @@ export async function runAIFlag( req, res ) {
|
|
|
3384
3383
|
let runAIFlag = 0;
|
|
3385
3384
|
store.questionAnswers.forEach( ( section ) => {
|
|
3386
3385
|
section.questions.forEach( ( question ) => {
|
|
3387
|
-
if ( question.answerType == 'image' && ( question?.userAnswer?.[0]?.runAIData.value == '
|
|
3386
|
+
if ( question.answerType == 'image' && ( question?.userAnswer?.[0]?.runAIData.value == 'False' || !question?.userAnswer?.[0]?.runAIData.value ) ) {
|
|
3388
3387
|
runAIFlag++;
|
|
3389
3388
|
}
|
|
3390
3389
|
} );
|
|
3391
3390
|
} );
|
|
3392
|
-
|
|
3393
3391
|
if ( runAIFlag ) {
|
|
3394
3392
|
let emailList = ele?.notifyFlags?.notifyType.includes( 'approver' ) ? ele.approver.map( ( approver ) => approver?.value ): [];
|
|
3395
3393
|
emailList = [ ...emailList, ...ele?.notifyFlags?.users?.map( ( user ) => user?.value ) ];
|