From ec9f47274ac28cdf4f3244d309818e10a3792de9 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Mon, 3 Apr 2017 21:23:54 -0300 Subject: [PATCH] Fix WS update functions --- kfet/templates/kfet/history.html | 2 +- kfet/templates/kfet/kpsul.html | 27 ++++++++++++++------------- kfet/templates/kfet/transfers.html | 1 - 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/kfet/templates/kfet/history.html b/kfet/templates/kfet/history.html index 5bcb960b..6d1b7497 100644 --- a/kfet/templates/kfet/history.html +++ b/kfet/templates/kfet/history.html @@ -135,7 +135,7 @@ $(document).ready(function() { // Synchronization // ----- - OperationWebSocket.add_handler(history.update_data); + OperationWebSocket.add_handler(data => history.update_data(data)); diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index a15546bb..e8bc3c39 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -667,19 +667,6 @@ $(document).ready(function() { } - // ----- - // Synchronization - // ----- - - OperationWebSocket.add_handler(kpsul.history.update_data); - OperationWebSocket.add_handler(kpsul.article_manager.update_data); - OperationWebSocket.add_handler(function(data) { - if (data['addcost']) { - Config.set('addcost_for', data['addcost']['for']); - Config.set('addcost_amount', data['addcost']['amount']); - displayAddcost(); - } - }); // ----- // General @@ -789,6 +776,20 @@ $(document).ready(function() { window.kpsul = new KPsulManager(env); + // ----- + // Synchronization + // ----- + + OperationWebSocket.add_handler(data => kpsul.history.update_data(data)); + OperationWebSocket.add_handler(data => kpsul.article_manager.update_data(data)); + OperationWebSocket.add_handler(function(data) { + if (data['addcost']) { + Config.set('addcost_for', data['addcost']['for']); + Config.set('addcost_amount', data['addcost']['amount']); + displayAddcost(); + } + }); + hardReset(); }); diff --git a/kfet/templates/kfet/transfers.html b/kfet/templates/kfet/transfers.html index 2c878f3c..15a546a9 100644 --- a/kfet/templates/kfet/transfers.html +++ b/kfet/templates/kfet/transfers.html @@ -11,7 +11,6 @@ - {% endblock %}