You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
The script currently calculates Total_Target_Seconds for employees without a check-in as 0. This causes an issue in the report where negative hours for absent days are not added to the Diff, leading to inaccurate data for absent employees.
Steps to Reproduce:
Run the report for a period where some employees are absent without any check-ins.
Observe that the Total_Target_Seconds for absent days is calculated as 0.
Notice that the report doesn't include negative hours in the Diff for those absent employees.
Expected Behavior:
The Total_Target_Seconds for absent employees should reflect the expected working hours for the absent day, and the report should show the corresponding negative hours in the Diff.
Actual Behavior:
The script sets Total_Target_Seconds to 0 for absent employees, causing their Diff to exclude the expected negative hours for the absent days.
Workaround:
A temporary workaround is to manually update the work_hour_report.py file to calculate Total_Target_Seconds for employees with an Absent status. However, this is not the most reliable method.
work_data = frappe.db.sql("""
SELECT name, log_date, employee, attendance, status, total_work_seconds, total_break_seconds,
actual_working_hours * 60 * 60 actual_working_seconds, expected_break_hours * 60 * 60 expected_break_hours,
target_hours,
CASE
WHEN status = 'Absent' THEN target_hours * 60 * 60
ELSE total_target_seconds
END as total_target_seconds,
(total_work_seconds - CASE
WHEN status = 'Absent' THEN target_hours * 60 * 60
ELSE total_target_seconds
END) as diff_log,
(actual_working_hours * 60 * 60 - CASE
WHEN status = 'Absent' THEN target_hours * 60 * 60
ELSE total_target_seconds
END) as actual_diff_log,
TIME(first_checkin) as first_in, TIME(last_checkout) as last_out
FROM `tabWorkday`
WHERE docstatus < 2 {} {}
ORDER BY log_date ASC
""".format(condition_date, condition_employee), as_dict=1)
Suggested Fix:
Add logic in utils.py to correctly calculate Total_Target_Seconds for Absent employees based on the defined working hours, ensuring the Diff reflects negative hours for absence.
The text was updated successfully, but these errors were encountered:
Description:
The script currently calculates Total_Target_Seconds for employees without a check-in as 0. This causes an issue in the report where negative hours for absent days are not added to the Diff, leading to inaccurate data for absent employees.
Steps to Reproduce:
Expected Behavior:
Actual Behavior:
Workaround:
A temporary workaround is to manually update the work_hour_report.py file to calculate Total_Target_Seconds for employees with an Absent status. However, this is not the most reliable method.
Suggested Fix:
Add logic in utils.py to correctly calculate Total_Target_Seconds for Absent employees based on the defined working hours, ensuring the Diff reflects negative hours for absence.
The text was updated successfully, but these errors were encountered: