From 8631d80bbb61c59987c2497a8a3ed1eb1a5f90ec Mon Sep 17 00:00:00 2001 From: emile Date: Thu, 21 Mar 2024 13:35:01 +0200 Subject: [PATCH] ss --- osinaweb/celerybeat-schedule.db | Bin 16384 -> 16384 bytes osinaweb/db.sqlite3 | Bin 937984 -> 937984 bytes .../__pycache__/tasks.cpython-310.pyc | Bin 1083 -> 1071 bytes osinaweb/osinacore/tasks.py | 37 +++++++++--------- .../__pycache__/celery.cpython-310.pyc | Bin 736 -> 738 bytes 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/osinaweb/celerybeat-schedule.db b/osinaweb/celerybeat-schedule.db index 1be98d6f76625997b7236defe0bdb832f2cf75a2..d8b202fb2a3ecfa45db18866ca5ec64b197c7d12 100644 GIT binary patch delta 38 ucmZo@U~Fh$+^}7ajaz|%f#L7uy>fw!_LKSLGuXK0`MC?vZLXDXRsaCsmJ3+` delta 38 ucmZo@U~Fh$+^}7ajYE)ufpOvFy>fw!s+0NUGuSxz40t9z-CQf*tN;Mjo(mWN diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3 index c349ed878f0650fe691d15222552b4d5bcb67150..2ffb026adc41ecb75a1457c3aea5a7fe5766d269 100644 GIT binary patch delta 336 zcmZozVA-(1a)LDD>WMPWjH@>$@aQs{H|OfM=jt*7F%u9o12GE_vjQ<25VLR3)#aFe ziRC*B8^d-jLB5%c+ZQr&dNT3wT;n;!bDn26&k3F_+rKe$F6UsBnm&(*Q%r-6nURT& z+Z;r(a+|R-b24$8Lc~lUV#Z)GqxL&IoIuP4#N0s4v;7Vauf}F(JC>g5><4%Yd02B; z?OBCbp0Vs?>DgRpz`??)HO-ujL0?gpar&8~ywXC3hE_(F3XZ;PTGPys#Cc%iteVqI vr=LH=t0)K)(VAw0q!8HvV(~VVyu2_T diff --git a/osinaweb/osinacore/__pycache__/tasks.cpython-310.pyc b/osinaweb/osinacore/__pycache__/tasks.cpython-310.pyc index 368ddb166bf7f5ba71bfade2f5f0356fe222ace4..2e72413240c5e00dee17048f29aa59f531344f37 100644 GIT binary patch delta 513 zcma)%!Ab)$5QZ~JHcew&ZAH)uT0{_EK=7a!y?OK^f-GyZ3tj83rja6S@h5 zY>bGWELaJVYz*0ytmKe2EsrKNY{?ydL@cmq;gWx2Y-@E)0R4B&X+@%4v?|hlSWjPI zdD>9vY2Q%YJNAt;&|VOvcd#TBv!7K}8`36TyP$n6V>rS9|(wU|3iAg`XFc zQXx@1EX{@wvAM}HW{vLT2){U46wcQlM?(PXi*8M0R{HX*erZDI(W2R$0YT<8KOy_Cm3-vmVWdHyG delta 520 zcmY+9Pm9zr7{>D^X`6Qb?G6a*>R}x4Fb6Mt5M=eVeuMSoB13oH6x!{!nr2vp4tp1R zklZ|Vjw0v>P``x7d;^c(busOzU;^RI`##U_Nj{0sVqA_!5phfI|CAs2+wq(0FYcyE z1})u^4XMdf^5WSBG|M342sI#WXzL-{LhCyPt*JVzX%=YFhFhW|Z+DbC$4SK=i}`#u)9o?VgM2!`giu zY@ue^6o(B5@+v@bN){t?4v!AQ2eQDWPA}#6?uQGo!DU*kwXDoHm=7$+SW6YSk$DIA zr>YZK-s!DZ={QNu4LrOSr9!Ee=dZ1oq^i#pa+0ZdKH4%rViH(%M4TXUyVv;U8KX2NH`0lX!X Aga7~l diff --git a/osinaweb/osinacore/tasks.py b/osinaweb/osinacore/tasks.py index 394abb66..3d0892cd 100644 --- a/osinaweb/osinacore/tasks.py +++ b/osinaweb/osinacore/tasks.py @@ -6,25 +6,24 @@ from django.db.models import Q @shared_task def set_offline(): all_staff_profiles = StaffProfile.objects.all() - for staff_profile in all_staff_profiles: last_working_point_activity = PointActivity.objects.filter( point__status='Working On', - point__task__assigned_to=staff_profile, - ).order_by('-end_time').first() - - if last_working_point_activity and last_working_point_activity.end_time <= datetime.now() - timedelta(minutes=10): - user = staff_profile.user - last_connection = Connection.objects.filter(user=user).order_by('-date').first() - if last_connection is None or last_connection.status != 'Offline': - Connection.objects.create( - status='Offline', - date=datetime.now(), - user=user - ) - Status.objects.create( - text='I am now offline!', - date=datetime.now().date(), - time=datetime.now().strftime('%I:%M %p'), - staff=user.staffprofile - ) \ No newline at end of file + point__task__assigned_to=staff_profile + ).last() + if last_working_point_activity and last_working_point_activity.end_time: + if last_working_point_activity.end_time <= datetime.now() - timedelta(minutes=10): + user = staff_profile.user + last_connection = Connection.objects.filter(user=user).order_by('-date').first() + if last_connection.status != 'Offline': + Connection.objects.create( + status='Offline', + date=datetime.now(), + user=user + ) + Status.objects.create( + text='I am now offline!', + date=datetime.now().date(), + time=datetime.now().strftime('%I:%M %p'), + staff=staff_profile + ) \ No newline at end of file diff --git a/osinaweb/osinaweb/__pycache__/celery.cpython-310.pyc b/osinaweb/osinaweb/__pycache__/celery.cpython-310.pyc index e551eedb13896b6a16991e3dcb08bb4ad31dda88..2fdff8c3d867ef81a845c0d03de89a5c25274df5 100644 GIT binary patch delta 42 vcmaFB`iPY`pO=@50SKHW|D;N6