From 2cf067473e78844aa616de98bcf0cfcadada2431 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 1 Aug 2019 14:16:52 +0200 Subject: DD hand analysis optional in API version Fixes #3 --- http/api/api.py | 1 + http/dealconvert.js | 10 +++++++++- http/index.html | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) (limited to 'http') diff --git a/http/api/api.py b/http/api/api.py index 6a9a785..0e5da8d 100644 --- a/http/api/api.py +++ b/http/api/api.py @@ -102,6 +102,7 @@ def handle_upload(response, request): output_id, output_path = _get_file_id() token = _get_rand_string(16) output_buffer = StringIO() + output.analyze = params.get('analyze_deals', False) output.output_content(output_buffer, dealset) with file(output_path, 'w') as output_file: json.dump({ diff --git a/http/dealconvert.js b/http/dealconvert.js index 2478fe9..ab8e90b 100644 --- a/http/dealconvert.js +++ b/http/dealconvert.js @@ -3,8 +3,14 @@ $(document).ready(function() { $('input[name="output"]').change(function() { if ($('input[name="output"]:checked').length > 0) { $('#submit-btn').removeAttr('disabled'); + if ($('input[name="output"][value="pbn"]').is(':checked')) { + $('#analyze-boards').removeAttr('disabled'); + } else { + $('#analyze-boards').attr('disabled', 'disabled').prop('checked', false); + } } else { $('#submit-btn').attr('disabled', 'disabled'); + $('#analyze-boards').attr('disabled', 'disabled').prop('checked', false); } }); $('#input-files').change(function() { @@ -17,6 +23,7 @@ $(document).ready(function() { output.push(this.value); }); var display = that.find('input[name="display"]').is(':checked'); + var analyze = that.find('input[name="analyze"]').is(':checked'); var files = {}; var formFiles = this['input-files'].files; if (formFiles.length) { @@ -42,7 +49,8 @@ $(document).ready(function() { 'name': file, 'content': files[file], 'output': output, - 'display_deals': display + 'display_deals': display, + 'analyze_deals': analyze }; $.ajax( 'api/upload/', diff --git a/http/index.html b/http/index.html index c43a2ac..51c6b34 100644 --- a/http/index.html +++ b/http/index.html @@ -149,6 +149,10 @@ +
+ + +
-- cgit v1.2.3