tango-app-api-trax 3.2.0-beta.7 → 3.2.0-beta.8
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
|
@@ -371,6 +371,13 @@ export async function redoChecklist( req, res ) {
|
|
|
371
371
|
|
|
372
372
|
let response = await processedChecklist.updateOne( { _id: req.body.payload._id }, updateData );
|
|
373
373
|
if ( response.modifiedCount || response.matchedCount ) {
|
|
374
|
+
let storeTimeZone = await storeService.findOne( { storeName: checklistDetails.storeName }, { 'storeProfile.timeZone': 1 } );
|
|
375
|
+
let currentDateTime;
|
|
376
|
+
if ( storeTimeZone?.storeProfile?.timeZone ) {
|
|
377
|
+
currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
|
|
378
|
+
} else {
|
|
379
|
+
currentDateTime = dayjs();
|
|
380
|
+
}
|
|
374
381
|
data = {
|
|
375
382
|
checklistId: checklistDetails.sourceCheckList_id,
|
|
376
383
|
checkListName: checklistDetails.checkListName,
|
|
@@ -386,7 +393,7 @@ export async function redoChecklist( req, res ) {
|
|
|
386
393
|
type: checklistDetails.checkListType,
|
|
387
394
|
userAnswer: userAnswer,
|
|
388
395
|
initiatedBy: req.user.userName,
|
|
389
|
-
initiatedTime: dayjs().format(),
|
|
396
|
+
initiatedTime: dayjs.utc( currentDateTime.format( 'hh:mm:ss A, DD MMM YYYY' ), 'hh:mm:ss A, DD MMM YYYY' ).format(),
|
|
390
397
|
answerType: question[sectionIndex].questions[req.body.payload.qno - 1].answerType,
|
|
391
398
|
submitedBy: checklistDetails.userName,
|
|
392
399
|
submitTime: checklistDetails.submitTime,
|
|
@@ -609,7 +609,14 @@ export const flagCardsV1 = async ( req, res ) => {
|
|
|
609
609
|
if ( data.questionFlag ) flagCards.questionFlag.count = data.questionFlag;
|
|
610
610
|
if ( data.delayInSubmission ) flagCards.delayInSubmission.count = data.delayInSubmission;
|
|
611
611
|
|
|
612
|
-
const publishedAiChecklists = await checklistconfigService.find(
|
|
612
|
+
const publishedAiChecklists = await checklistconfigService.find(
|
|
613
|
+
{
|
|
614
|
+
client_id: clientId,
|
|
615
|
+
publish: true,
|
|
616
|
+
checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] },
|
|
617
|
+
},
|
|
618
|
+
{ checkListType: 1 },
|
|
619
|
+
);
|
|
613
620
|
|
|
614
621
|
if ( !publishedAiChecklists?.length ) {
|
|
615
622
|
return res.sendError( { error: 'No Data Found' }, 204 );
|
|
@@ -623,7 +630,9 @@ export const flagCardsV1 = async ( req, res ) => {
|
|
|
623
630
|
|
|
624
631
|
if ( resultData && resultData.status_code === '200' ) {
|
|
625
632
|
published.forEach( ( item ) => {
|
|
626
|
-
|
|
633
|
+
if ( resultData[item] ) {
|
|
634
|
+
flagCards.detectionFlag.count += resultData[item];
|
|
635
|
+
}
|
|
627
636
|
} );
|
|
628
637
|
flagCards.totalFlag = flagCards.detectionFlag.count;
|
|
629
638
|
}
|
|
@@ -737,8 +746,14 @@ export const flagComparisonCardsV1 = async ( req, res ) => {
|
|
|
737
746
|
|
|
738
747
|
console.log( dayjs( toDate ).startOf( 'day' ).subtract( 1, 'day' ).format( 'YYYY-MM-DD' ), 'new start of' );
|
|
739
748
|
|
|
740
|
-
const publishedAiChecklists = await checklistconfigService.find(
|
|
741
|
-
|
|
749
|
+
const publishedAiChecklists = await checklistconfigService.find(
|
|
750
|
+
{
|
|
751
|
+
client_id: requestData.clientId,
|
|
752
|
+
publish: true,
|
|
753
|
+
checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] },
|
|
754
|
+
},
|
|
755
|
+
{ checkListType: 1 },
|
|
756
|
+
);
|
|
742
757
|
if ( !publishedAiChecklists?.length ) {
|
|
743
758
|
return 0;
|
|
744
759
|
}
|
|
@@ -750,7 +765,11 @@ export const flagComparisonCardsV1 = async ( req, res ) => {
|
|
|
750
765
|
|
|
751
766
|
if ( resultData?.status_code === '200' ) {
|
|
752
767
|
let result = 0;
|
|
753
|
-
published.forEach( ( item ) =>
|
|
768
|
+
published.forEach( ( item ) => {
|
|
769
|
+
if ( resultData[item] ) {
|
|
770
|
+
result += resultData[item];
|
|
771
|
+
}
|
|
772
|
+
} );
|
|
754
773
|
return result;
|
|
755
774
|
}
|
|
756
775
|
return 0;
|
|
@@ -804,7 +823,7 @@ export const flagTablesV1 = async ( req, res ) => {
|
|
|
804
823
|
);
|
|
805
824
|
|
|
806
825
|
if ( requestData?.filter === 'all' ) {
|
|
807
|
-
findAndQuery.push( { $or: [ { questionFlag: { $gte: 1 } }, { timeFlag: { $gte: 1 } }, { checkListType: { $
|
|
826
|
+
findAndQuery.push( { $or: [ { questionFlag: { $gte: 1 } }, { timeFlag: { $gte: 1 } }, { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] } } ] } );
|
|
808
827
|
} else if ( requestData?.filter === 'question' ) {
|
|
809
828
|
findAndQuery.push( { checkListType: 'custom' } );
|
|
810
829
|
findAndQuery.push( { questionFlag: { $gte: 1 } } );
|
|
@@ -812,7 +831,7 @@ export const flagTablesV1 = async ( req, res ) => {
|
|
|
812
831
|
findAndQuery.push( { checkListType: 'custom' } );
|
|
813
832
|
findAndQuery.push( { timeFlag: { $gte: 1 } } );
|
|
814
833
|
} else if ( requestData?.filter === 'detection' ) {
|
|
815
|
-
findAndQuery.push( { checkListType: { $
|
|
834
|
+
findAndQuery.push( { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] } } );
|
|
816
835
|
}
|
|
817
836
|
|
|
818
837
|
findQuery.push( { $match: { $and: findAndQuery } } );
|
|
@@ -2629,7 +2648,7 @@ export const checklistDropdownV1 = async ( req, res ) => {
|
|
|
2629
2648
|
$or: [
|
|
2630
2649
|
{ questionFlag: { $gte: 1 } },
|
|
2631
2650
|
{ timeFlag: { $gte: 1 } },
|
|
2632
|
-
{ checkListType: { $
|
|
2651
|
+
{ checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] } },
|
|
2633
2652
|
],
|
|
2634
2653
|
},
|
|
2635
2654
|
] } },
|