diff --git a/osinaweb/support/__pycache__/consumers.cpython-310.pyc b/osinaweb/support/__pycache__/consumers.cpython-310.pyc index 1dd39c58..3c387e52 100644 Binary files a/osinaweb/support/__pycache__/consumers.cpython-310.pyc and b/osinaweb/support/__pycache__/consumers.cpython-310.pyc differ diff --git a/osinaweb/support/consumers.py b/osinaweb/support/consumers.py index 4c3e45d4..cee137e5 100644 --- a/osinaweb/support/consumers.py +++ b/osinaweb/support/consumers.py @@ -170,18 +170,26 @@ class TicketRoomConsumer(WebsocketConsumer): })) def modify_online_user(self): + connections = TicketConnection.objects.filter(ticket=self.ticket, terminated_at__isnull=True) + event = { 'type': 'user_connection_handler', 'user': self.user, + 'connections': list(connections.values( + 'user__username', + 'user__first_name', + 'user__last_name', + 'date', + 'terminated_at' + )), } async_to_sync(self.channel_layer.group_send)( self.ticket_number, event ) def user_connection_handler(self, event): - connections = TicketConnection.objects.filter(ticket=self.ticket, terminated_at__isnull=True) context = { - 'connections': connections, + 'connections': event['connections'], 'user': event['user'] } html = render_to_string("details_templates/partials/ticket-online-users.html", context=context)