Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error deleting attendance records, i can't check-in #456

Open
Malvinito opened this issue Jan 9, 2025 · 1 comment
Open

Error deleting attendance records, i can't check-in #456

Malvinito opened this issue Jan 9, 2025 · 1 comment

Comments

@Malvinito
Copy link

Bug Report

Description

I can't check-in, the application is issuing errors after deleting attendance registers as administrator.

Steps to Reproduce

  1. Delete all records under attendance activities and hour account
  2. Try to check-in clicking the upper button

Expected Behavior

Records in the application has to be added

Actual Behavior

Only records at "my attendances" was added

Screenshots

[If applicable, provide screenshots illustrating the issue.]

Environment

  • Django Version:
    $ pip show django
    Name: Django
    Version: 4.2.11
    Summary: A high-level Python web framework that encourages rapid development and clean, pragmatic design.
    Home-page: https://www.djangoproject.com/
    Author: Django Software Foundation
    Author-email: [email protected]
    License: BSD-3-Clause
    Location: /opt/horilla/myenv/lib/python3.11/site-packages
    Requires: asgiref, sqlparse
    Required-by: django-apscheduler, django-auditlog, django-cors-headers, django-filter, django-haystack, django-import-export, django-jsonfield, django-model-utils, django-simple-history, django_csp, djangorestframework, djangorestframework_simplejwt, drf-yasg

  • Python Version:

$ python --version
Python 3.11.2

  • Operating System: [Debian Linux 12 (bookworm)]
  • Browser: [Firefox and Chrome]

Additional Information

output in django log:

/opt/horilla/myenv/lib/python3.11/site-packages/django/db/models/fields/init.py:1595: RuntimeWarning: DateTimeField AttendanceActivity.in_datetime received a naive datetime (2025-01-09 12:23:23.556486) while time zone support is active.
warnings.warn(
'NoneType' object has no attribute 'split'
/opt/horilla/myenv/lib/python3.11/site-packages/django/db/models/fields/init.py:1595: RuntimeWarning: DateTimeField AttendanceActivity.in_datetime received a naive datetime (2025-01-09 12:23:23.638563) while time zone support is active.
warnings.warn(
Internal Server Error: /attendance/clock-in
Traceback (most recent call last):
File "/opt/horilla/horilla/decorators.py", line 234, in wrapped_view
func = view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/horilla/horilla/decorators.py", line 260, in wrapped_view
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/horilla/attendance/views/clock_in_out.py", line 283, in clock_in
attendance = clock_in_attendance_and_activity(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/horilla/attendance/views/clock_in_out.py", line 176, in clock_in_attendance_and_activity
attendance.save()
File "/opt/horilla/attendance/models.py", line 384, in save
self.handle_overtime_conditions()
File "/opt/horilla/attendance/models.py", line 370, in handle_overtime_conditions
if condition.auto_approve_ot and self.overtime_second >= strtime_seconds(
^^^^^^^^^^^^^^^^
File "/opt/horilla/attendance/methods/utils.py", line 60, in strtime_seconds
return sum(a * b for a, b in zip(ftr, map(int, time.split(":"))))
^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'split'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/horilla/myenv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/horilla/myenv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/horilla/horilla/decorators.py", line 249, in wrapped_view
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/horilla/horilla/decorators.py", line 260, in wrapped_view
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/horilla/attendance/views/clock_in_out.py", line 283, in clock_in
attendance = clock_in_attendance_and_activity(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/horilla/attendance/views/clock_in_out.py", line 176, in clock_in_attendance_and_activity
attendance.save()
File "/opt/horilla/attendance/models.py", line 384, in save
self.handle_overtime_conditions()
File "/opt/horilla/attendance/models.py", line 370, in handle_overtime_conditions
if condition.auto_approve_ot and self.overtime_second >= strtime_seconds(
^^^^^^^^^^^^^^^^
File "/opt/horilla/attendance/methods/utils.py", line 60, in strtime_seconds
return sum(a * b for a, b in zip(ftr, map(int, time.split(":"))))
^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'split'
[09/Jan/2025 12:23:23] "GET /attendance/clock-in HTTP/1.1" 500 131839

@horilla-opensource
Copy link
Owner

Hi @Malvinito,

Thank you for reporting this issue!

After reviewing the logs and your description, we found that the problem occurs when certain fields in the "Attendance Break Points" settings are saved with null values. We've already updated the code to handle such cases, ensuring that null values do not break the functionality.

Please pull the latest changes from the GitHub repository.
Additionally, we recommend saving the "Attendance Break Points" once more with some default values to ensure everything works as expected.

With Regards,
Team Horilla

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants