From dd3cb9195180083e996636de8c08c3b5f01083f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Montan=CC=83ana?= Date: Tue, 30 May 2023 00:47:24 +0200 Subject: [PATCH] Fix compare problem in Excel files --- benchmark/scripts/be_flask.py | 6 +++--- benchmark/scripts/templates/partials/js_report.js | 7 ++++++- benchmark/scripts/templates/partials/js_select.js | 9 +++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/benchmark/scripts/be_flask.py b/benchmark/scripts/be_flask.py index ae83515..3cbd75b 100755 --- a/benchmark/scripts/be_flask.py +++ b/benchmark/scripts/be_flask.py @@ -63,7 +63,7 @@ def index(compare="False"): @app.route("/show", methods=["post"]) def show(): selected_file = request.form["selected-file"] - compare = request.form["compare"] == "true" + compare = request.form["compare"].capitalize() == "True" with open(os.path.join(Folders.results, selected_file)) as f: data = json.load(f) try: @@ -82,8 +82,8 @@ def show(): @app.route("/excel", methods=["post"]) def excel(): - selected_files = request.json["selected-files"] - compare = request.json["compare"] == "true" + selected_files = request.json["selectedFiles"] + compare = request.json["compare"] book = None try: for file_name in selected_files: diff --git a/benchmark/scripts/templates/partials/js_report.js b/benchmark/scripts/templates/partials/js_report.js index 2607d95..482f9c9 100644 --- a/benchmark/scripts/templates/partials/js_report.js +++ b/benchmark/scripts/templates/partials/js_report.js @@ -17,11 +17,16 @@ $(document).ready(function () { }); function excelFile() { var selectedFiles = ["{{ file }}"]; + var compare = "{{ compare }}" == "True"; + var data = { + "selectedFiles": selectedFiles, + "compare": compare + }; // send data to server with ajax post $.ajax({ type:'POST', url:'/excel', - data: JSON.stringify(selectedFiles), + data: JSON.stringify(data), contentType: "application/json", dataType: 'json', success: function(data){ diff --git a/benchmark/scripts/templates/partials/js_select.js b/benchmark/scripts/templates/partials/js_select.js index 3c83544..00af45b 100644 --- a/benchmark/scripts/templates/partials/js_select.js +++ b/benchmark/scripts/templates/partials/js_select.js @@ -54,11 +54,16 @@ function excel() { alert("Select at least one file"); return; } - // send data to server with ajax post + var compare = $("#compare").is(':checked'); + // send data to server with ajax post + var data = { + selectedFiles: selectedFiles, + compare: compare + }; $.ajax({ type:'POST', url:'/excel', - data: JSON.stringify(selectedFiles), + data: JSON.stringify(data), contentType: "application/json", dataType: 'json', success: function(data){