From a1289da09cef9a5befaeb141ef7b4b1a338fa294 Mon Sep 17 00:00:00 2001 From: Vivek Santayana Date: Sun, 5 Mar 2023 00:28:54 +0000 Subject: [PATCH] Added analysis button and scripting --- ref-test/app/admin/static/js/script.js | 26 +++++++++++++++++++ .../templates/admin/settings/questions.html | 11 +++++++- ref-test/app/admin/templates/admin/test.html | 12 ++++++++- ref-test/app/admin/templates/admin/tests.html | 9 +++++++ ref-test/app/view/static/js/view.js | 21 +++++++++++++++ ref-test/app/view/templates/view/console.html | 13 +++++++++- 6 files changed, 89 insertions(+), 3 deletions(-) diff --git a/ref-test/app/admin/static/js/script.js b/ref-test/app/admin/static/js/script.js index caaee59..7a6a3e6 100644 --- a/ref-test/app/admin/static/js/script.js +++ b/ref-test/app/admin/static/js/script.js @@ -88,6 +88,19 @@ $('.test-action').click(function(event) { }) } else if (action == 'edit') { window.location.href = `/admin/test/${id}/` + } else if (action == 'analyse') { + $.ajax({ + url: `/admin/analysis/`, + type: 'POST', + data: JSON.stringify({'id': id, 'class': 'test'}), + contentType: 'application/json', + success: function(response) { + window.location.href = response + }, + error: function(response){ + error_response(response) + }, + }) } event.preventDefault() @@ -123,6 +136,19 @@ $('.edit-question-dataset').click(function(event) { window.location.href = `/admin/view/${id}` } else if (action == 'download') { window.location.href = `/admin/settings/questions/download/${id}/` + } else if (action == 'analyse') { + $.ajax({ + url: `/admin/analysis/`, + type: 'POST', + data: JSON.stringify({'id': id, 'class': 'dataset'}), + contentType: 'application/json', + success: function(response) { + window.location.href = response + }, + error: function(response){ + error_response(response) + }, + }) } } event.preventDefault() diff --git a/ref-test/app/admin/templates/admin/settings/questions.html b/ref-test/app/admin/templates/admin/settings/questions.html index d9e941a..0dd67c8 100644 --- a/ref-test/app/admin/templates/admin/settings/questions.html +++ b/ref-test/app/admin/templates/admin/settings/questions.html @@ -52,6 +52,15 @@ {{ element.tests|length }} + + +
- {% endblock %}