tango-app-api-trax 3.6.0-sec-4 → 3.6.0-sec-6
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
|
@@ -18,11 +18,6 @@ import mongoose from 'mongoose';
|
|
|
18
18
|
export const downloadInsert = async ( req, res ) => {
|
|
19
19
|
try {
|
|
20
20
|
let requestData = req.body;
|
|
21
|
-
let fromDate = new Date( requestData.fromDate );
|
|
22
|
-
let toDate = new Date( requestData.toDate );
|
|
23
|
-
let userTimezoneOffset = toDate.getTimezoneOffset() * 60000;
|
|
24
|
-
toDate = new Date( toDate.getTime() - userTimezoneOffset );
|
|
25
|
-
toDate.setUTCHours( 23, 59, 59, 59 );
|
|
26
21
|
let name;
|
|
27
22
|
let fileType = requestData?.fileType || 'pdfzip';
|
|
28
23
|
|
|
@@ -44,55 +39,60 @@ export const downloadInsert = async ( req, res ) => {
|
|
|
44
39
|
}
|
|
45
40
|
}
|
|
46
41
|
// console.log( requestData );
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
42
|
+
// // No Need to Check
|
|
43
|
+
// let fromDate = new Date( requestData.fromDate );
|
|
44
|
+
// let toDate = new Date( requestData.toDate );
|
|
45
|
+
// let userTimezoneOffset = toDate.getTimezoneOffset() * 60000;
|
|
46
|
+
// toDate = new Date( toDate.getTime() - userTimezoneOffset );
|
|
47
|
+
// toDate.setUTCHours( 23, 59, 59, 59 );
|
|
48
|
+
// if ( requestData.sourceCheckList_id && requestData.sourceCheckList_id != '' ) {
|
|
49
|
+
// let getChecklistQuery = [];
|
|
50
|
+
// getChecklistQuery.push( { $project: { sourceCheckList_id: 1, date_iso: 1, store_id: 1, userEmail: 1, checklistStatus: 1, redoStatus: 1 } } );
|
|
51
|
+
|
|
52
|
+
// if ( requestData.filtertype ==='Clusters' ) {
|
|
53
|
+
// getChecklistQuery.push( {
|
|
54
|
+
// $match: {
|
|
55
|
+
// $and: [
|
|
56
|
+
// { sourceCheckList_id: new mongoose.Types.ObjectId( requestData.sourceCheckList_id ) },
|
|
57
|
+
// { date_iso: { $gte: fromDate, $lte: toDate } },
|
|
58
|
+
// { store_id: { $in: requestData.storeIds } },
|
|
59
|
+
// ],
|
|
60
|
+
// $or: [
|
|
61
|
+
// { checklistStatus: 'submit' },
|
|
62
|
+
// { redoStatus: true },
|
|
63
|
+
// ],
|
|
64
|
+
// },
|
|
65
|
+
// } );
|
|
66
|
+
// } else {
|
|
67
|
+
// // console.log( requestData );
|
|
68
|
+
// getChecklistQuery.push( {
|
|
69
|
+
// $match: {
|
|
70
|
+
// $and: [
|
|
71
|
+
// { sourceCheckList_id: new mongoose.Types.ObjectId( requestData.sourceCheckList_id ) },
|
|
72
|
+
// { date_iso: { $gte: fromDate, $lte: toDate } },
|
|
73
|
+
// { userEmail: { $in: requestData.userEmailList } },
|
|
74
|
+
// ],
|
|
75
|
+
// $or: [
|
|
76
|
+
// { checklistStatus: 'submit' },
|
|
77
|
+
// { redoStatus: true },
|
|
78
|
+
// ],
|
|
79
|
+
// },
|
|
80
|
+
// } );
|
|
81
|
+
// }
|
|
82
|
+
// // getChecklistQuery.push( { $count: 'totalCount' } );
|
|
83
|
+
|
|
84
|
+
// let getChecklistCount = await processedchecklistService.aggregate( getChecklistQuery );
|
|
85
|
+
// // console.log( getChecklistCount );
|
|
86
|
+
// if ( requestData.insertType === 'task' ) {
|
|
87
|
+
// getChecklistCount = await processedTaskService.aggregate( getChecklistQuery );
|
|
88
|
+
// }
|
|
89
|
+
// if ( getChecklistCount && getChecklistCount.length > 0 ) {
|
|
90
|
+
// // console.log( 'if' );
|
|
91
|
+
// // console.log( 'getChecklistCountgetChecklistCount[0].totalCount =>', getChecklistCount[0]?.totalCount );
|
|
92
|
+
// } else {
|
|
93
|
+
// return res.sendError( { error: 'No Data Found' }, 400 );
|
|
94
|
+
// }
|
|
95
|
+
// }
|
|
96
96
|
|
|
97
97
|
if ( requestData.fileType == 'pdf' ) {
|
|
98
98
|
if ( requestData?.sourceCheckList_id && requestData?.sourceCheckList_id != '' ) {
|
|
@@ -728,6 +728,7 @@ export const userPerformance = async ( req, res ) => {
|
|
|
728
728
|
userEmail: 1,
|
|
729
729
|
userName: 1,
|
|
730
730
|
questionCount: 1,
|
|
731
|
+
redoStatus: 1,
|
|
731
732
|
},
|
|
732
733
|
} );
|
|
733
734
|
|
|
@@ -745,6 +746,7 @@ export const userPerformance = async ( req, res ) => {
|
|
|
745
746
|
submittedChecklistQuestionCount: {
|
|
746
747
|
$sum: { $cond: [ { $eq: [ '$checklistStatus', 'submit' ] }, '$questionCount', 0 ] },
|
|
747
748
|
},
|
|
749
|
+
redo: { $sum: { $cond: [ { $eq: [ '$redoStatus', true ] }, 1, 0 ] } },
|
|
748
750
|
},
|
|
749
751
|
} );
|
|
750
752
|
|
|
@@ -816,6 +818,7 @@ export const userPerformance = async ( req, res ) => {
|
|
|
816
818
|
'Email': element.userEmail || '--',
|
|
817
819
|
'Checklist Assigned': element.checkListCount || '--',
|
|
818
820
|
'Flags': element.flaggedCount || '--',
|
|
821
|
+
'ReDo': element.redo || '--',
|
|
819
822
|
'Completion %': element.completion || '--',
|
|
820
823
|
'Compliance %': element.compliance || '--',
|
|
821
824
|
'Performance %': element.performance || '--',
|