From 7346a15d344a8ad0c5fdd23e96f23456f7742983 Mon Sep 17 00:00:00 2001 From: Rao Shahbaz Date: Tue, 14 Jun 2022 15:37:19 +0500 Subject: [PATCH] small changes --- backend/controllers/attendance_controller.js | 19 ++++++++++++++++--- login_app/lib/pages/monthly_attendance.dart | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/backend/controllers/attendance_controller.js b/backend/controllers/attendance_controller.js index a2b629a..6293268 100644 --- a/backend/controllers/attendance_controller.js +++ b/backend/controllers/attendance_controller.js @@ -839,10 +839,23 @@ module.exports.GetLastReport = (req, res) => { } ] } + }, + { + '$addFields': { + 'HOUR': { + '$divide': [ + { + '$subtract': [ + '$TakenOut', '$TakenIn' + ] + }, 3600000 + ] + } + } }, { - '$addFields': { - 'TotalHours': { - '$sum': '$HOUR' + '$addFields': { + 'TotalHours': { + '$sum': '$HOUR' }, 'WorkingHours': { '$sum': '$WorkingHours' diff --git a/login_app/lib/pages/monthly_attendance.dart b/login_app/lib/pages/monthly_attendance.dart index 018395e..b30201b 100644 --- a/login_app/lib/pages/monthly_attendance.dart +++ b/login_app/lib/pages/monthly_attendance.dart @@ -67,7 +67,7 @@ class _MonthlyAttendanceState extends State { (list['TakenOut'] != null) ? '${DateFormat('dd-MM-yyyy h:mma').format(DateTime.parse(list['TakenOut'].toString()).toLocal())}' : "--" )), - DataCell(Text(list['TotalHours'].toString())), + DataCell(Text(list['TotalHours'].toStringAsFixed(2))), ])) .toList(); }