emile 11 months ago
parent fa3d60443d
commit 18bf8da413

Binary file not shown.

@ -170,16 +170,17 @@ class TicketRoomConsumer(WebsocketConsumer):
def modify_online_user(self): def modify_online_user(self):
connections = TicketConnection.objects.filter(ticket=self.ticket, terminated_at__isnull=True) connections = TicketConnection.objects.filter(ticket=self.ticket, terminated_at__isnull=True)
sorted_connections = list(connections)
online_connections = [] online_connections = []
for connection in connections: for connection in sorted_connections:
connection_data = { if hasattr(connection.user, 'customerprofile'):
connection_data = {
'first_name': connection.user.first_name, 'first_name': connection.user.first_name,
'last_name': connection.user.last_name, 'last_name': connection.user.last_name,
} }
online_connections.append(connection_data) online_connections.append(connection_data)
event = { event = {
'type': 'user_connection_handler', 'type': 'online_user_connection_handler',
'user': self.user, 'user': self.user,
'connections': online_connections, 'connections': online_connections,
} }
@ -187,7 +188,7 @@ class TicketRoomConsumer(WebsocketConsumer):
self.ticket_number, event self.ticket_number, event
) )
def user_connection_handler(self, event): def online_user_connection_handler(self, event):
context = { context = {
'connections': event['connections'], 'connections': event['connections'],
'user': event['user'] 'user': event['user']

Loading…
Cancel
Save