From fa4018665f045b819009ed5dbf3ee3f4345a348d Mon Sep 17 00:00:00 2001 From: sharjeel khan Date: Fri, 13 May 2022 14:53:33 +0500 Subject: [PATCH] Attendance Controller Changes --- backend/controllers/attendance_controller.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/controllers/attendance_controller.js b/backend/controllers/attendance_controller.js index 6014007..238a1bf 100644 --- a/backend/controllers/attendance_controller.js +++ b/backend/controllers/attendance_controller.js @@ -114,7 +114,7 @@ module.exports.report = (req, res) => { const aggr = [ { $match: { - 'TakenIn': { + 'ActionDetails.ActionTakenOn': { '$gte': new Date(req.body.StartDate), '$lte': new Date(new Date(req.body.EndDate).setHours(23, 59, 59)) } @@ -157,7 +157,12 @@ module.exports.report = (req, res) => { }, 'Leave': { '$sum': { + $cond: [{ $eq: ['$TransactionType', "Leave"] }, 1, 0] + + $cond: [{ $eq: ['$TransactionType', "Leave",'$ApprovedDetails', true + ] }, 1, 0] + } }, }