tango-app-api-trax 3.5.1-alpha-3 → 3.5.2-alpha-2
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 +3 -3
- package/src/controllers/gallery.controller.js +7 -0
- package/src/controllers/internalTrax.controller.js +46 -10
- package/src/controllers/mobileTrax.controller.js +37 -38
- package/src/controllers/teaxFlag.controller.js +36 -12
- package/src/controllers/trax.controller.js +4 -15
- package/src/controllers/traxDashboard.controllers.js +317 -9
- package/src/hbs/login-otp.hbs +943 -943
- package/src/routes/internalTraxApi.router.js +2 -1
- package/src/routes/trax.routes.js +1 -1
|
@@ -9,7 +9,7 @@ import utc from 'dayjs/plugin/utc.js';
|
|
|
9
9
|
dayjs.extend( utc );
|
|
10
10
|
// import admin from 'firebase-admin';
|
|
11
11
|
import { sendPushNotification } from 'tango-app-api-middleware';
|
|
12
|
-
|
|
12
|
+
import * as clientService from '../services/clients.services.js';
|
|
13
13
|
|
|
14
14
|
export const welcome = async ( req, res ) => {
|
|
15
15
|
try {
|
|
@@ -1165,7 +1165,7 @@ export const userDropdown = async ( req, res ) => {
|
|
|
1165
1165
|
}
|
|
1166
1166
|
};
|
|
1167
1167
|
|
|
1168
|
-
export const
|
|
1168
|
+
export const checklistInfoOld = async ( req, res ) => {
|
|
1169
1169
|
try {
|
|
1170
1170
|
let requestData = req.body;
|
|
1171
1171
|
let fromDate = new Date( requestData.fromDate );
|
|
@@ -1445,6 +1445,297 @@ export const checklistInfo = async ( req, res ) => {
|
|
|
1445
1445
|
}
|
|
1446
1446
|
};
|
|
1447
1447
|
|
|
1448
|
+
export const checklistInfo = async ( req, res ) => {
|
|
1449
|
+
try {
|
|
1450
|
+
let requestData = req.body;
|
|
1451
|
+
let fromDate = new Date( requestData.fromDate );
|
|
1452
|
+
let toDate = new Date( requestData.toDate );
|
|
1453
|
+
let userTimezoneOffset = toDate.getTimezoneOffset() * 60000;
|
|
1454
|
+
toDate = new Date( toDate.getTime() - userTimezoneOffset );
|
|
1455
|
+
toDate.setUTCHours( 23, 59, 59, 59 );
|
|
1456
|
+
let result = {};
|
|
1457
|
+
|
|
1458
|
+
// Get User Based Checklist //
|
|
1459
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
1460
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
1461
|
+
// End: Get User Based Checklist////
|
|
1462
|
+
|
|
1463
|
+
let findQuery = [];
|
|
1464
|
+
let findAndQuery = [];
|
|
1465
|
+
findAndQuery.push(
|
|
1466
|
+
{ client_id: requestData.clientId },
|
|
1467
|
+
{ date_iso: { $gte: fromDate } },
|
|
1468
|
+
{ date_iso: { $lte: toDate } },
|
|
1469
|
+
{ checkListType: { $eq: 'custom' } },
|
|
1470
|
+
// { store_id: { $in: requestData.storeId } },
|
|
1471
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
1472
|
+
);
|
|
1473
|
+
|
|
1474
|
+
if ( requestData.checklistStatus && requestData.checklistStatus != 'All' ) {
|
|
1475
|
+
if ( requestData.checklistStatus == 'redo' ) {
|
|
1476
|
+
findAndQuery.push( { redoStatus: true } );
|
|
1477
|
+
} else {
|
|
1478
|
+
findAndQuery.push( { checklistStatus: requestData.checklistStatus } );
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
if ( requestData.groupByType == 'Checklist' ) {
|
|
1483
|
+
findAndQuery.push( { sourceCheckList_id: new mongoose.Types.ObjectId( requestData.groupByValue ) } );
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
if ( requestData.groupByType == 'User' ) {
|
|
1487
|
+
findAndQuery.push( { userEmail: requestData.groupByValue } );
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
if ( requestData.groupByType == 'Store' ) {
|
|
1491
|
+
findAndQuery.push( { store_id: requestData.groupByValue } );
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
findQuery.push( { $match: { $and: findAndQuery } } );
|
|
1495
|
+
|
|
1496
|
+
if ( requestData.searchValue && requestData.searchValue != '' ) {
|
|
1497
|
+
if ( requestData.groupByType == 'Checklist' ) {
|
|
1498
|
+
// findQuery.push( { $match: { $or: [ { storeName: { $regex: requestData.searchValue, $options: 'i' } } ] } } );
|
|
1499
|
+
let storeList = requestData.searchValue.split( ',' ).map( ( item ) => item.trim().toLowerCase() );
|
|
1500
|
+
let query;
|
|
1501
|
+
if ( storeList.length > 1 ) {
|
|
1502
|
+
findQuery.push( { $addFields: { store: { $toLower: '$storeName' } } } );
|
|
1503
|
+
query = { store: { $in: storeList } };
|
|
1504
|
+
} else {
|
|
1505
|
+
query = { $or: [
|
|
1506
|
+
{ storeName: { $regex: requestData.searchValue.trim(), $options: 'i' } },
|
|
1507
|
+
{ userEmail: { $regex: requestData.searchValue.trim(), $options: 'i' } },
|
|
1508
|
+
{ userName: { $regex: requestData.searchValue.trim(), $options: 'i' } },
|
|
1509
|
+
] };
|
|
1510
|
+
}
|
|
1511
|
+
findQuery.push( { $match: { $or: [ query ] } } );
|
|
1512
|
+
} else {
|
|
1513
|
+
// findQuery.push( { $match: { $or: [ { checkListName: { $regex: requestData.searchValue, $options: 'i' } } ] } } );
|
|
1514
|
+
let checkListSearch = requestData.searchValue.split( ',' ).map( ( item ) => item.trim().toLowerCase() );
|
|
1515
|
+
let query;
|
|
1516
|
+
if ( checkListSearch.length > 1 ) {
|
|
1517
|
+
findQuery.push( { $addFields: { cheklistlowercase: { $toLower: '$checkListName' } } } );
|
|
1518
|
+
query = { cheklistlowercase: { $in: checkListSearch } };
|
|
1519
|
+
} else {
|
|
1520
|
+
query = { checkListName: { $regex: requestData.searchValue.trim(), $options: 'i' } };
|
|
1521
|
+
}
|
|
1522
|
+
findQuery.push( { $match: { $or: [ query ] } } );
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
findQuery.push( { $sort: { _id: -1 } } );
|
|
1527
|
+
|
|
1528
|
+
// findQuery.push( {
|
|
1529
|
+
// $group: {
|
|
1530
|
+
// _id: { store: '$store_id', email: '$userEmail', checklistId: '$sourceCheckList_id' },
|
|
1531
|
+
// checkListName: { $first: '$checkListName' },
|
|
1532
|
+
// coverage: { $first: '$coverage' },
|
|
1533
|
+
// createdByName: { $first: '$createdByName' },
|
|
1534
|
+
// userName: { $first: '$userName' },
|
|
1535
|
+
// checklistStatus: { $last: '$checklistStatus' },
|
|
1536
|
+
// userEmail: { $first: '$userEmail' },
|
|
1537
|
+
// submitTime_string: { $push: '$submitTime_string' },
|
|
1538
|
+
// storeName: { $first: '$storeName' },
|
|
1539
|
+
// checkListType: { $first: '$checkListType' },
|
|
1540
|
+
// scheduleRepeatedType: { $first: '$scheduleRepeatedType' },
|
|
1541
|
+
// timeFlag: { $sum: '$timeFlag' },
|
|
1542
|
+
// questionFlag: { $sum: '$questionFlag' },
|
|
1543
|
+
// date_iso: { $first: '$date_iso' },
|
|
1544
|
+
// store_id: { $first: '$store_id' },
|
|
1545
|
+
// date_string: { $first: '$date_string' },
|
|
1546
|
+
// sourceCheckList_id: { $first: '$sourceCheckList_id' },
|
|
1547
|
+
// reinitiateStatus: { $first: '$reinitiateStatus' },
|
|
1548
|
+
// redoStatus: { $first: '$redoStatus' },
|
|
1549
|
+
// submitCount: { $sum: {
|
|
1550
|
+
// $cond: {
|
|
1551
|
+
// if: { $eq: [ '$checklistStatus', 'submit' ] },
|
|
1552
|
+
// then: 1,
|
|
1553
|
+
// else: 0,
|
|
1554
|
+
// },
|
|
1555
|
+
// } },
|
|
1556
|
+
// approvalByEmail: { $first: '$approvalByEmail' },
|
|
1557
|
+
// approvalTime_string: { $push: '$approvalTime_string' },
|
|
1558
|
+
// idList: { $push: '$_id' },
|
|
1559
|
+
// },
|
|
1560
|
+
// } );
|
|
1561
|
+
|
|
1562
|
+
findQuery.push( {
|
|
1563
|
+
$project: {
|
|
1564
|
+
_id: 0,
|
|
1565
|
+
idList: 1,
|
|
1566
|
+
checkListName: 1,
|
|
1567
|
+
coverage: 1,
|
|
1568
|
+
createdByName: 1,
|
|
1569
|
+
userName: 1,
|
|
1570
|
+
checklistStatus: 1,
|
|
1571
|
+
// userEmail: '$_id.email',
|
|
1572
|
+
// submitTime_string: { $arrayElemAt: [ '$submitTime_string', 0 ] },
|
|
1573
|
+
userEmail: 1,
|
|
1574
|
+
submitTime_string: 1,
|
|
1575
|
+
storeName: 1,
|
|
1576
|
+
checkListType: 1,
|
|
1577
|
+
scheduleRepeatedType: 1,
|
|
1578
|
+
timeFlag: 1,
|
|
1579
|
+
questionFlag: 1,
|
|
1580
|
+
date_iso: 1,
|
|
1581
|
+
// store_id: '$_id.store',
|
|
1582
|
+
store_id: 1,
|
|
1583
|
+
timeFlag: 1,
|
|
1584
|
+
date_string: 1,
|
|
1585
|
+
sourceCheckList_id: 1,
|
|
1586
|
+
reinitiateStatus: 1,
|
|
1587
|
+
redoStatus: 1,
|
|
1588
|
+
// submitCount: 1,
|
|
1589
|
+
submitCount: { $sum: {
|
|
1590
|
+
$cond: {
|
|
1591
|
+
if: { $eq: [ '$checklistStatus', 'submit' ] },
|
|
1592
|
+
then: 1,
|
|
1593
|
+
else: 0,
|
|
1594
|
+
},
|
|
1595
|
+
} },
|
|
1596
|
+
approvalByEmail: 1,
|
|
1597
|
+
approvalTime_string: 1,
|
|
1598
|
+
},
|
|
1599
|
+
} );
|
|
1600
|
+
|
|
1601
|
+
findQuery.push( {
|
|
1602
|
+
$project: {
|
|
1603
|
+
idList: 1,
|
|
1604
|
+
checkListName: 1,
|
|
1605
|
+
coverage: 1,
|
|
1606
|
+
checkListChar: { $substr: [ '$checkListName', 0, 2 ] },
|
|
1607
|
+
createdByName: 1,
|
|
1608
|
+
userName: 1,
|
|
1609
|
+
checklistStatus: {
|
|
1610
|
+
$cond: {
|
|
1611
|
+
if: { $eq: [ '$checklistStatus', 'submit' ] },
|
|
1612
|
+
then: 'Submitted',
|
|
1613
|
+
else: {
|
|
1614
|
+
$cond: {
|
|
1615
|
+
if: { $eq: [ '$checklistStatus', 'open' ] },
|
|
1616
|
+
then: 'Open',
|
|
1617
|
+
else: 'In Progress',
|
|
1618
|
+
},
|
|
1619
|
+
},
|
|
1620
|
+
},
|
|
1621
|
+
},
|
|
1622
|
+
userEmail: 1,
|
|
1623
|
+
// submitTime_string: 1,
|
|
1624
|
+
submitTime_string: {
|
|
1625
|
+
$cond: {
|
|
1626
|
+
if: { $eq: [ '$checklistStatus', 'submit' ] },
|
|
1627
|
+
then: '$submitTime_string',
|
|
1628
|
+
else: '',
|
|
1629
|
+
},
|
|
1630
|
+
},
|
|
1631
|
+
storeName: 1,
|
|
1632
|
+
checkListType: 1,
|
|
1633
|
+
scheduleRepeatedType: 1,
|
|
1634
|
+
flaggedChecklist: { $add: [ '$timeFlag', '$questionFlag' ] },
|
|
1635
|
+
timeFlag: 1,
|
|
1636
|
+
questionFlag: 1,
|
|
1637
|
+
date_iso: 1,
|
|
1638
|
+
store_id: 1,
|
|
1639
|
+
timeFlag: 1,
|
|
1640
|
+
date_string: 1,
|
|
1641
|
+
checklistDate: '$date_string',
|
|
1642
|
+
sourceCheckList_id: 1,
|
|
1643
|
+
reinitiateStatus: 1,
|
|
1644
|
+
redoStatus: 1,
|
|
1645
|
+
submitCount: 1,
|
|
1646
|
+
approvalByEmail: 1,
|
|
1647
|
+
approvalTime_string: 1,
|
|
1648
|
+
},
|
|
1649
|
+
} );
|
|
1650
|
+
|
|
1651
|
+
// let getTotalCount = await processedchecklistService.aggregate( findQuery );
|
|
1652
|
+
// if ( !getTotalCount.length ) {
|
|
1653
|
+
// return res.sendError( { error: 'No Data Found' }, 204 );
|
|
1654
|
+
// }
|
|
1655
|
+
|
|
1656
|
+
if ( requestData.sortColumnName && requestData.sortColumnName != '' && requestData.sortBy && requestData.sortBy !='' ) {
|
|
1657
|
+
findQuery.push( { $sort: { [requestData.sortColumnName]: requestData.sortBy } } );
|
|
1658
|
+
}
|
|
1659
|
+
let limit = parseInt( requestData?.limit ) || 10;
|
|
1660
|
+
let skip = limit * ( requestData?.offset ) || 0;
|
|
1661
|
+
|
|
1662
|
+
findQuery.push(
|
|
1663
|
+
{
|
|
1664
|
+
$facet: {
|
|
1665
|
+
data: [
|
|
1666
|
+
{ $skip: skip }, { $limit: limit },
|
|
1667
|
+
],
|
|
1668
|
+
count: [
|
|
1669
|
+
{ $count: 'total' },
|
|
1670
|
+
],
|
|
1671
|
+
},
|
|
1672
|
+
},
|
|
1673
|
+
);
|
|
1674
|
+
|
|
1675
|
+
|
|
1676
|
+
let getChecklistPerformanceData = await processedchecklistService.aggregate( findQuery );
|
|
1677
|
+
if ( !getChecklistPerformanceData[0].data.length ) {
|
|
1678
|
+
return res.sendError( 'No data found', 204 );
|
|
1679
|
+
}
|
|
1680
|
+
result = {
|
|
1681
|
+
totalCount: getChecklistPerformanceData?.[0]?.count?.[0]?.total || 0,
|
|
1682
|
+
checklistInfo: getChecklistPerformanceData?.[0]?.data || [],
|
|
1683
|
+
};
|
|
1684
|
+
|
|
1685
|
+
result.checklistInfo.forEach( ( item ) => {
|
|
1686
|
+
item.date_string = dayjs( item.date_string, 'YYYY-MM-DD' ).format( 'DD MMM YYYY' );
|
|
1687
|
+
} );
|
|
1688
|
+
if ( requestData.export ) {
|
|
1689
|
+
const exportdata = [];
|
|
1690
|
+
result.checklistInfo.forEach( ( element ) => {
|
|
1691
|
+
if ( requestData.groupByType==='Checklist' ) {
|
|
1692
|
+
exportdata.push( {
|
|
1693
|
+
'Date': element.date_string || '--',
|
|
1694
|
+
'Store Name': element.storeName || '--',
|
|
1695
|
+
'Checklist Owner': element.userName || '--',
|
|
1696
|
+
'Status': element.checklistStatus || '--',
|
|
1697
|
+
'Submitted By': element.userName || '--',
|
|
1698
|
+
'Submitted On': element.submitTime_string || '--',
|
|
1699
|
+
'Flags': element.flaggedChecklist || '--',
|
|
1700
|
+
'Approval By': element.approvalByEmail || '--',
|
|
1701
|
+
'Approval On': element.approvalTime_string || '--',
|
|
1702
|
+
} );
|
|
1703
|
+
} else if ( requestData.groupByType==='Store' ) {
|
|
1704
|
+
exportdata.push( {
|
|
1705
|
+
'CheckList Name': element.checkListName || '--',
|
|
1706
|
+
'Checklist Owner': element.userName || '--',
|
|
1707
|
+
'Status': element.checklistStatus || '--',
|
|
1708
|
+
'Submitted By': element.userName || '--',
|
|
1709
|
+
'Submitted On': element.submitTime_string || '--',
|
|
1710
|
+
'Flags': element.flaggedChecklist || '--',
|
|
1711
|
+
'Approval By': element.approvalByEmail || '--',
|
|
1712
|
+
'Approval On': element.approvalTime_string || '--',
|
|
1713
|
+
|
|
1714
|
+
} );
|
|
1715
|
+
} else {
|
|
1716
|
+
exportdata.push( {
|
|
1717
|
+
'Date': element.date_string || '--',
|
|
1718
|
+
'CheckList Name': element.checkListName || '--',
|
|
1719
|
+
'Store Name': element.storeName || '--',
|
|
1720
|
+
'Checklist Owner': element.userName || '--',
|
|
1721
|
+
'Status': element.checklistStatus || '--',
|
|
1722
|
+
'Submitted On': element.submitTime_string || '--',
|
|
1723
|
+
'Flags': element.flaggedChecklist || '--',
|
|
1724
|
+
'Approval By': element.approvalByEmail || '--',
|
|
1725
|
+
'Approval On': element.approvalTime_string || '--',
|
|
1726
|
+
} );
|
|
1727
|
+
}
|
|
1728
|
+
} );
|
|
1729
|
+
return await download( exportdata, res );
|
|
1730
|
+
}
|
|
1731
|
+
return res.sendSuccess( result );
|
|
1732
|
+
} catch ( error ) {
|
|
1733
|
+
console.log( 'error =>', error );
|
|
1734
|
+
logger.error( { error: error, message: req.query, function: 'checklistInfo' } );
|
|
1735
|
+
return res.sendError( { error: error }, 500 );
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1738
|
+
|
|
1448
1739
|
export const infoCardsOld = async ( req, res ) => {
|
|
1449
1740
|
try {
|
|
1450
1741
|
let requestData = req.body;
|
|
@@ -2481,14 +2772,14 @@ export const overallComparisonCardsV1 = async ( req, res ) => {
|
|
|
2481
2772
|
rangeTwoToDate.setUTCHours( 23, 59, 59, 59 );
|
|
2482
2773
|
} else if ( requestData.dateType == 'monthly' ) {
|
|
2483
2774
|
rangeOneFromDate = new Date( requestData.toDate );
|
|
2484
|
-
rangeOneFromDate.setDate( rangeOneFromDate.getDate() -
|
|
2775
|
+
rangeOneFromDate.setDate( rangeOneFromDate.getDate() - 29 );
|
|
2485
2776
|
rangeOneToDate = new Date( requestData.toDate );
|
|
2486
2777
|
rangeOneToDate = new Date( rangeOneToDate.getTime() - userTimezoneOffset );
|
|
2487
2778
|
rangeOneToDate.setUTCHours( 23, 59, 59, 59 );
|
|
2488
2779
|
rangeTwoToDate = new Date( requestData.toDate );
|
|
2489
|
-
rangeTwoToDate.setDate( rangeTwoToDate.getDate() -
|
|
2780
|
+
rangeTwoToDate.setDate( rangeTwoToDate.getDate() - 30 );
|
|
2490
2781
|
rangeTwoFromDate = new Date( rangeTwoToDate );
|
|
2491
|
-
rangeTwoFromDate.setDate( rangeTwoFromDate.getDate() -
|
|
2782
|
+
rangeTwoFromDate.setDate( rangeTwoFromDate.getDate() - 29 );
|
|
2492
2783
|
rangeTwoToDate = new Date( rangeTwoToDate.getTime() - userTimezoneOffset );
|
|
2493
2784
|
rangeTwoToDate.setUTCHours( 23, 59, 59, 59 );
|
|
2494
2785
|
} else {
|
|
@@ -2681,6 +2972,13 @@ export const overallComparisonCardsV1 = async ( req, res ) => {
|
|
|
2681
2972
|
overallComparisonCards.complianceRate.comparisonData = Math.abs( overallComparisonCards.complianceRate.comparisonData );
|
|
2682
2973
|
}
|
|
2683
2974
|
|
|
2975
|
+
overallComparisonCards.traxMonthlyComparison = false;
|
|
2976
|
+
let traxMonthlyComparisonData = await clientService.findOne( { clientId: requestData.clientId }, { traxMonthlyComparison: 1 } );
|
|
2977
|
+
// console.log( 'traxMonthlyComparisonData', traxMonthlyComparisonData );
|
|
2978
|
+
if ( traxMonthlyComparisonData && traxMonthlyComparisonData.traxMonthlyComparison ) {
|
|
2979
|
+
overallComparisonCards.traxMonthlyComparison = traxMonthlyComparisonData.traxMonthlyComparison;
|
|
2980
|
+
}
|
|
2981
|
+
|
|
2684
2982
|
let result = {
|
|
2685
2983
|
'overallComparisonCards': overallComparisonCards,
|
|
2686
2984
|
};
|
|
@@ -3003,14 +3301,14 @@ export const infoComparisonCardsV1 = async ( req, res ) => {
|
|
|
3003
3301
|
rangeTwoToDate.setUTCHours( 23, 59, 59, 59 );
|
|
3004
3302
|
} else if ( requestData.dateType == 'monthly' ) {
|
|
3005
3303
|
rangeOneFromDate = new Date( requestData.toDate );
|
|
3006
|
-
rangeOneFromDate.setDate( rangeOneFromDate.getDate() -
|
|
3304
|
+
rangeOneFromDate.setDate( rangeOneFromDate.getDate() - 29 );
|
|
3007
3305
|
rangeOneToDate = new Date( requestData.toDate );
|
|
3008
3306
|
rangeOneToDate = new Date( rangeOneToDate.getTime() - userTimezoneOffset );
|
|
3009
3307
|
rangeOneToDate.setUTCHours( 23, 59, 59, 59 );
|
|
3010
3308
|
rangeTwoToDate = new Date( requestData.toDate );
|
|
3011
|
-
rangeTwoToDate.setDate( rangeTwoToDate.getDate() -
|
|
3309
|
+
rangeTwoToDate.setDate( rangeTwoToDate.getDate() - 30 );
|
|
3012
3310
|
rangeTwoFromDate = new Date( rangeTwoToDate );
|
|
3013
|
-
rangeTwoFromDate.setDate( rangeTwoFromDate.getDate() -
|
|
3311
|
+
rangeTwoFromDate.setDate( rangeTwoFromDate.getDate() - 29 );
|
|
3014
3312
|
rangeTwoToDate = new Date( rangeTwoToDate.getTime() - userTimezoneOffset );
|
|
3015
3313
|
rangeTwoToDate.setUTCHours( 23, 59, 59, 59 );
|
|
3016
3314
|
} else {
|
|
@@ -3066,8 +3364,14 @@ export const infoComparisonCardsV1 = async ( req, res ) => {
|
|
|
3066
3364
|
'flags': flags,
|
|
3067
3365
|
'completionScore': completionScore,
|
|
3068
3366
|
'complianceRate': complianceRate,
|
|
3367
|
+
'traxMonthlyComparison': false,
|
|
3069
3368
|
};
|
|
3070
3369
|
|
|
3370
|
+
let traxMonthlyComparisonData = await clientService.findOne( { clientId: requestData.clientId }, { traxMonthlyComparison: 1 } );
|
|
3371
|
+
if ( traxMonthlyComparisonData && traxMonthlyComparisonData.traxMonthlyComparison ) {
|
|
3372
|
+
infoComparisonCards.traxMonthlyComparison = traxMonthlyComparisonData.traxMonthlyComparison;
|
|
3373
|
+
}
|
|
3374
|
+
|
|
3071
3375
|
// Get User Based Checklist //
|
|
3072
3376
|
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
3073
3377
|
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
@@ -3220,7 +3524,11 @@ export const infoComparisonCardsV1 = async ( req, res ) => {
|
|
|
3220
3524
|
let rangeTwoData = await processedchecklistService.aggregate( rangeTwoFindQuery );
|
|
3221
3525
|
|
|
3222
3526
|
if ( !rangeOneData.length ) {
|
|
3223
|
-
return res.sendError( { error: 'No Data Found' }, 204 );
|
|
3527
|
+
// return res.sendError( { error: 'No Data Found' }, 204 );
|
|
3528
|
+
let result = {
|
|
3529
|
+
'infoComparisonCards': infoComparisonCards,
|
|
3530
|
+
};
|
|
3531
|
+
return res.sendSuccess( result );
|
|
3224
3532
|
}
|
|
3225
3533
|
|
|
3226
3534
|
if ( rangeOneData.length >0 && rangeTwoData.length >0 ) {
|