From 077c1271b96564e0638d7fb6c1e0b2c05f1dbfb6 Mon Sep 17 00:00:00 2001 From: Hussein <17926508+Husseinfo@users.noreply.github.com> Date: Sun, 31 Mar 2024 17:51:02 +0200 Subject: [PATCH] fix --- tracker/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tracker/views.py b/tracker/views.py index 0fbb089..ba3fcdb 100644 --- a/tracker/views.py +++ b/tracker/views.py @@ -120,8 +120,9 @@ def recognize(request): user = User.objects.get(id=user_id) name = 'Unknown' if user_id in (-1, None) else user.first_name + ' ' + user.last_name last_attendance = user.attendance_set.last() + inout = not last_attendance.inout if last_attendance else True if confidence >= 85: - Attendance.objects.create(user=user, date=datetime.now(), inout=not last_attendance.inout) + Attendance.objects.create(user=user, date=datetime.now(), inout=inout) return render(request, 'recognize.html', {'id': user_id, 'name': name, 'confidence': confidence}) return render(request, 'recognize.html', {'confidence': -1}) return render(request, 'recognize.html')