diff --git a/ref-test/app/analysis/static/css/analysis.css b/ref-test/app/analysis/static/css/analysis.css index de45037..b7ad60d 100644 --- a/ref-test/app/analysis/static/css/analysis.css +++ b/ref-test/app/analysis/static/css/analysis.css @@ -1,30 +1,8 @@ -.info-panel { - display: none; -} - -.control-panel { - margin-left: auto; - margin-right: 0; - width:fit-content; -} - #alert-box { margin: 30px auto; max-width: 460px; } -.block { - border: 2px solid black; - border-radius: 10px; - margin: 10px; - padding: 5px; -} - -.question-body, .question-block { - padding: 0px 2em; -} - -blockquote { - padding: 0px 2em; - font-style: italic; +.cell-percentage::after { + content: '%'; } \ No newline at end of file diff --git a/ref-test/app/analysis/static/js/analysis.js b/ref-test/app/analysis/static/js/analysis.js index 0d78304..3fec9d1 100644 --- a/ref-test/app/analysis/static/js/analysis.js +++ b/ref-test/app/analysis/static/js/analysis.js @@ -1,130 +1,27 @@ -// Variable Declarations -const $control_panel = $('.control-panel') -const $info_panel = $('.info-panel') -const $viewer_panel = $('.viewer-panel') +// Analyse Button Listener +$('.button-analyse').click(function(event) { -var element_index = 0 + let buttonClass = $(this).data('class') + let id = null -// Info Button Listener -$control_panel.find('button').click(function(event){ - if ($info_panel.is(":hidden")) { - $viewer_panel.hide() - $info_panel.fadeIn() - $(this).addClass('active') - } else { - $info_panel.hide() - $viewer_panel.fadeIn() - $(this).removeClass('active') + if (buttonClass == 'test' ) { + id = $('#select-test').children('option:selected').val() + } else if (buttonClass == 'dataset' ) { + id = $('#select-dataset').children('option:selected').val() } - event.preventDefault() -}) -function parse_data(data) { - var block - var obj - for (let i = 0; i < data.length; i++) { - block = data[i] - obj = document.createElement('div') - obj.classList = 'block' - if (block['type'] == 'question') { - text = document.createElement('p') - text.innerHTML = `Question ${block['q_no'] + 1}. ${block['text']}` - obj.append(text) - question_body = document.createElement('div') - question_body.className ='question-body' - type = document.createElement('p') - type.innerHTML = `Question Type: ${block['q_type']}` - question_body.append(type) - options = document.createElement('p') - options.innerHTML = 'Options:' - option_list = document.createElement('ul') - for (let _i = 0; _i < block['options'].length; _i++) { - option = document.createElement('li') - option.innerHTML = block['options'][_i] - if (block['correct'] == _i) { - option.innerHTML += ' Correct' - } - option_list.append(option) - } - options.append(option_list) - question_body.append(options) - tags = document.createElement('p') - tags.innerHTML = `Tags:` - tag_list = document.createElement('ul') - for (let _i = 0; _i < block['tags'].length; _i++) { - tag = document.createElement('li') - tag.innerHTML = block['tags'][_i] - tag_list.append(tag) - } - tags.append(tag_list) - question_body.append(tags) - obj.append(question_body) - } else if (block['type'] == 'block') { - meta = document.createElement('p') - meta.innerHTML = `Block ${i+1}. ${block['questions'].length} questions.` - obj.append(meta) - header = document.createElement('blockquote') - header.innerText = block['question_header'] - obj.append(header) - var block_question = document.createElement('div') - var question - block_question.className = 'question-block' - for (let _i = 0; _i < block['questions'].length; _i++) { - question = block['questions'][_i] - text = document.createElement('p') - text.innerHTML = `Question ${question['q_no'] + 1}. ${question['text']}` - block_question.append(text) - question_body = document.createElement('div') - question_body.className ='question-body' - type = document.createElement('p') - type.innerHTML = `Question Type: ${question['q_type']}` - question_body.append(type) - options = document.createElement('p') - options.innerHTML = 'Options:' - option_list = document.createElement('ul') - for (let __i = 0; __i < question['options'].length; __i++) { - option = document.createElement('li') - option.innerHTML = question['options'][__i] - if (question['correct'] == __i) { - option.innerHTML += ' Correct' - } - option_list.append(option) - } - options.append(option_list) - question_body.append(options) - tags = document.createElement('p') - tags.innerHTML = `Tags:` - tag_list = document.createElement('ul') - for (let __i = 0; __i < question['tags'].length; __i++) { - tag = document.createElement('li') - tag.innerHTML = question['tags'][__i] - tag_list.append(tag) - } - tags.append(tag_list) - question_body.append(tags) - block_question.append(question_body) - obj.append(block_question) - } - } - $viewer_panel.append(obj) - } -} - -// Fetch data once page finishes loading -$(window).on('load', function() { $.ajax({ - url: target, + url: `/admin/analysis/`, type: 'POST', - data: JSON.stringify({ - 'id': id, - 'action': 'fetch' - }), + data: JSON.stringify({'id': id, 'class': buttonClass}), contentType: 'application/json', success: function(response) { - parse_data(response['data']) + window.location.href = response + }, + error: function(response){ + error_response(response) }, - error: function(response) { - console.log(response) - } }) + + event.preventDefault() }) \ No newline at end of file diff --git a/ref-test/app/analysis/templates/analysis/analysis.html b/ref-test/app/analysis/templates/analysis/analysis.html index 5de1fed..627d311 100644 --- a/ref-test/app/analysis/templates/analysis/analysis.html +++ b/ref-test/app/analysis/templates/analysis/analysis.html @@ -1,74 +1,22 @@ -{% extends "view/components/base.html" %} +{% extends "analysis/components/datatable.html" %} {% block style %} {% endblock %} {% block content %} -
- This page lists all the questions in the selected dataset. + Analysis for {{ type }} {{ subject }}.
- Questions in the test are arranged in blocks. Blocks can be of two types: Blocks of multiple related questions, and Single Questions that are not part of a block. - You can add, remove, or edit both Blockss and Questions through this editor. -
-- Blocks are useful when you have a section of the test that contains multiple questions that are related to each other, for example if there is a scenario-based section where a series of questions are about the same situation. -
-- Blocks can contain any number of questions within them, but cannot contain nested blocks. -
-- When you set up a block, you can also add header text that will be displayed with each question. - You can use this to provide common information for a scenario across a series of questions. -
-- Questions come in three types: -
- Normally, multiple choice questions will have the order of the options randomised. -
-- Questions will be displayed to candidates in a randomised order. - Blocks of questions will be kept together, but the order within the block will also be randomised. -
-- Questions can also be categorised using tags. -
-- Placeholder for Questions Remaining in a Block -
-
- In order to show how many questions are remaining inside a block, e.g. to say ‘the next n questions are about a specific scenario’, the app uses the placeholder <block_remaining_questions>
.
-
+ Question + | ++ Percent Correct + | ++ Answers + | ++ Tags + | + + + {% for question in questions %} +||
---|---|---|---|---|---|
+ {{ question.q_no + 1 }} + | ++ {{ ((analysis.answers[question.q_no][question.correct] or 0)*100/(analysis.answers[question.q_no].values())|sum())|round(2) }} + | +
+
|
+
+
|
+