Fix compare problem in Excel files

This commit is contained in:
2023-05-30 00:47:24 +02:00
parent 40af738ed9
commit dd3cb91951
3 changed files with 16 additions and 6 deletions

View File

@@ -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:

View File

@@ -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){

View File

@@ -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){