diff --git a/kfet/templates/kfet/account_read.html b/kfet/templates/kfet/account_read.html
index 7decefc2..3974e0a2 100644
--- a/kfet/templates/kfet/account_read.html
+++ b/kfet/templates/kfet/account_read.html
@@ -13,7 +13,6 @@
-
{% if account.user == request.user %}
@@ -115,16 +114,7 @@ $(document).ready(function() {
// Synchronization
// -----
- var websocket_msg_default = {'opegroups':[],'opes':[]}
-
- var websocket_protocol = window.location.protocol == 'https:' ? 'wss' : 'ws';
- var location_host = window.location.host;
- var location_url = window.location.pathname.startsWith('/gestion/') ? location_host + '/gestion' : location_host;
- var socket = new ReconnectingWebSocket(websocket_protocol+"://" + location_url + "/ws/k-fet/k-psul/");
- socket.onmessage = function(e) {
- var data = $.extend({}, websocket_msg_default, JSON.parse(e.data));
- history.update_data(data);
- }
+ OperationWebSocket.add_handler((data) => history.update_data(data));
Config.reset(history.reset.bind(history));
});
diff --git a/kfet/templates/kfet/transfers.html b/kfet/templates/kfet/transfers.html
index 15a546a9..088228d8 100644
--- a/kfet/templates/kfet/transfers.html
+++ b/kfet/templates/kfet/transfers.html
@@ -63,18 +63,7 @@ $(document).ready(function() {
// Synchronization
// -----
-
- var websocket_msg_default = {'opes':[]}
-
- var websocket_protocol = window.location.protocol == 'https:' ? 'wss' : 'ws';
- var location_host = window.location.host;
- var location_url = window.location.pathname.startsWith('/gestion/') ? location_host + '/gestion' : location_host;
- var socket = new ReconnectingWebSocket(websocket_protocol+"://" + location_url + "/ws/k-fet/k-psul/");
- socket.onmessage = function(e) {
- var data = $.extend({}, websocket_msg_default, JSON.parse(e.data));
- history.update_data(data);
-
- }
+ OperationWebSocket.add_handler((data) => history.update_data(data));
Config.reset(history.reset.bind(history));
});
diff --git a/kfet/views.py b/kfet/views.py
index 7ff4a59e..b7d47022 100644
--- a/kfet/views.py
+++ b/kfet/views.py
@@ -17,7 +17,7 @@ from django.http import JsonResponse, Http404
from django.forms import formset_factory
from django.forms.models import model_to_dict
from django.db import transaction
-from django.db.models import F, Sum, Prefetch, Count
+from django.db.models import Q, F, Sum, Prefetch, Count
from django.db.models.functions import Coalesce
from django.utils import timezone
from django.utils.crypto import get_random_string