|
|
|
@ -41,9 +41,10 @@ class OnlineUserConsumer(WebsocketConsumer):
|
|
|
|
|
self.modify_online_user()
|
|
|
|
|
|
|
|
|
|
def modify_online_user(self):
|
|
|
|
|
cutoff_date = datetime.now() - timedelta(days=30)
|
|
|
|
|
connections = Connection.objects.all()
|
|
|
|
|
online_connections = connections.filter(online=True)
|
|
|
|
|
offline_connections = connections.filter(online=False, last_seen__isnull=False).order_by('-last_seen')[:5]
|
|
|
|
|
offline_connections = connections.filter(online=False, last_seen__isnull=False, last_seen__gte=cutoff_date).order_by('-last_seen')
|
|
|
|
|
sorted_connections = list(online_connections) + list(offline_connections)
|
|
|
|
|
online_users_ids = [connection.user.id for connection in online_connections]
|
|
|
|
|
customer_connections = []
|
|
|
|
|