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