updated absensi
This commit is contained in:
@@ -64,7 +64,7 @@ const create = async (req, res) => {
|
||||
|
||||
if (attendance && attendance.clock_in) {
|
||||
// 🕛 Jika jam antara 12–15 → lunch_in
|
||||
if (currentHour >= 12 && currentHour < 18 && !attendance.lunch_in) {
|
||||
if (currentHour >= 12 && currentHour < 15 && !attendance.lunch_in) {
|
||||
attendance.lunch_in = now.toDate();
|
||||
await attendance.save({ transaction: t });
|
||||
await t.commit();
|
||||
@@ -72,7 +72,7 @@ const create = async (req, res) => {
|
||||
}
|
||||
|
||||
// 🕒 Jika jam >= 15 → otomatis clock_out
|
||||
if (currentHour >= 19 && !attendance.clock_out) {
|
||||
if (currentHour >= 15 && !attendance.clock_out) {
|
||||
attendance.clock_out = now.toDate();
|
||||
|
||||
const durationMs = moment(attendance.clock_out).diff(moment(attendance.clock_in));
|
||||
@@ -89,7 +89,7 @@ const create = async (req, res) => {
|
||||
clock_in: moment(attendance.clock_in).tz('Asia/Jakarta').format('YYYY-MM-DD HH:mm:ss'),
|
||||
clock_out: moment(attendance.clock_out).tz('Asia/Jakarta').format('YYYY-MM-DD HH:mm:ss'),
|
||||
work_duration: attendance.work_duration,
|
||||
}, 'Absen pulang otomatis setelah jam 15:00');
|
||||
}, 'Absen pulang berhasil');
|
||||
}
|
||||
|
||||
await t.rollback();
|
||||
|
||||
Reference in New Issue
Block a user