From 59d67ac89d1b4f8158e553dafb048040af2a1cee Mon Sep 17 00:00:00 2001 From: emile Date: Thu, 11 Jul 2024 22:00:39 +0300 Subject: [PATCH] new --- .../__pycache__/consumers.cpython-310.pyc | Bin 5469 -> 5549 bytes osinaweb/osinacore/consumers.py | 19 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/osinaweb/osinacore/__pycache__/consumers.cpython-310.pyc b/osinaweb/osinacore/__pycache__/consumers.cpython-310.pyc index 0f43f4c61074a31d1ada074633b43e0ce56152a8..7f417cf307c533655f8173f89825ac6f7db22252 100644 GIT binary patch delta 1017 zcmZ{j%TE(g6vpQiI`2*&6vQGgLE}h*F)`t#7(oQVB3h6~c#TY3+DIF3hlOScArK=A zAMtEi(715L!jQOiW8%uht&@3{ZC%w`Ds@=l@GbnCf{M}uH=et&<^cXuBndU3i)t8vI(}~@>w8= zwvZCcFqXxi3A4hJR!eENkh49RM8R4~vlf0<+>%~G6hm_BB_{KjwG*xpsO%}ZQZZ9x zE0*I)%T~#99ELaLi=bgf9&7EPecgmELX2Z3yi_a{(o0URSXi(v$HF7IseuNnpu;(c zfB}{KD}xviAqL_vJ%~-phnPQsW|@KGY2Elk8HXNhS8F*3)edcd9&(3p7dPTn!459( zVp-jW4s5PIgMHdrXm~%X0ZieXo`VVes`ta zBf%sr(XXgwDXu5^D$!|VK?YgYMV7*Otsb-CWf;fr;S1s;>X;-S!Zcx(!YPjD=kax< z4m%^wRnt5)1EVZWwHd-J?N{kxE`@Wr9XWz6bfULl2tP$TW1W=tua%lig(cs`5?6gE zL@Lz~=p{GBV-rTW_A2S3*=?%%y#qKBtAmaGY^)X{nUnM&sbPFmRWtIKq;J0O`wa^J zVYPn;e;-ADdqJmYThG`NYB=>OWO@7w<@iM7f8EVfOO`B7Fq>^S(N4}U|8wp+?d|_|R+~OI8ihzi z4dL~qacN>H{>Ipl49X>pP7L=ge3QnV+BxpYKF=wc@Isk5<;%~x&sP`=%^dk%SFzsX zD}U9)zOsNF8O>LG*_Sf-&zr%ZFkwu`N?>CCd zq~kiCCj`e$z%oC`RCvdexi(Bk;^|q}E8NM7v2-Dy&!)YpLf*}eSgz+xOl+$O3;T;w z_HH)si3Zdq>?D;yG-0@h5GvDIJu{iX%JIiBgX!=~tA!d{5q6mvN8sxIt zqIFOUStZWG$5^G*jIs-Us*hMR%*3nVu~y4!U%b*7OTnr>#Rj1|(#b~GMkD*!e0MNM z=t0<;Fi1xUCkQ5iEGWt;&+%qmah@u4I^rCmkI;{>6;Vez*v<`7qlD{(((XuYx1b1{ zMg?;q8tq72pydI=MZzwEO&F)Qs1ZrjgBULDhKD%gT$e=>UTY1o9-U;DV7GZdPSL~= z`4FW$OjA0Hc(50~n02sd?y00$RM9f42g4>k`Q7457WWUJLW zPGvgzV8{-OK1f=LV}TVim8%G65Vl-$p%-VdD7RsCZm1NQ^tPg431uY*JQ^C&XBD0zj9b6-r+z}B}=%@*NmZ214y-h$il`h;+B ls(|6rA1|<0;gYTk2R36zSsxsZpO(pfEX>5)cJ#&?egVZr#d!b# diff --git a/osinaweb/osinacore/consumers.py b/osinaweb/osinacore/consumers.py index 845b1f7a..0d9adbff 100644 --- a/osinaweb/osinacore/consumers.py +++ b/osinaweb/osinacore/consumers.py @@ -46,19 +46,24 @@ class OnlineUserConsumer(WebsocketConsumer): offline_connections = connections.filter(online=False, last_seen__isnull=False).order_by('-last_seen')[:5] sorted_connections = list(online_connections) + list(offline_connections) online_users_ids = [connection.user.id for connection in online_connections] - customer_connectionse = [] - staff_connectionse = [] + customer_connections = [] + staff_connections = [] for connection in sorted_connections: + connection_data = { + 'user_id': connection.user.id, + 'username': connection.user.username, + 'last_seen': connection.last_seen.isoformat() if connection.last_seen else None + } if hasattr(connection.user, 'customerprofile'): - customer_connectionse.append(connection) + customer_connections.append(connection_data) elif hasattr(connection.user, 'staffprofile'): - staff_connectionse.append(connection) + staff_connections.append(connection_data) - print(staff_connectionse) + print(staff_connections) event = { 'type': 'online_user_connection_handler', - 'staff_connections': staff_connectionse, - 'customer_connections': customer_connectionse, + 'staff_connections': staff_connections, + 'customer_connections': customer_connections, 'online_users_ids': online_users_ids } async_to_sync(self.channel_layer.group_send)(