Added analysis button and scripting
This commit is contained in:
parent
ea86fd9ae6
commit
a1289da09c
@ -88,6 +88,19 @@ $('.test-action').click(function(event) {
|
|||||||
})
|
})
|
||||||
} else if (action == 'edit') {
|
} else if (action == 'edit') {
|
||||||
window.location.href = `/admin/test/${id}/`
|
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()
|
event.preventDefault()
|
||||||
@ -123,6 +136,19 @@ $('.edit-question-dataset').click(function(event) {
|
|||||||
window.location.href = `/admin/view/${id}`
|
window.location.href = `/admin/view/${id}`
|
||||||
} else if (action == 'download') {
|
} else if (action == 'download') {
|
||||||
window.location.href = `/admin/settings/questions/download/${id}/`
|
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()
|
event.preventDefault()
|
||||||
|
@ -52,6 +52,15 @@
|
|||||||
{{ element.tests|length }}
|
{{ element.tests|length }}
|
||||||
</td>
|
</td>
|
||||||
<td class="row-actions">
|
<td class="row-actions">
|
||||||
|
<a
|
||||||
|
href="javascript:void(0)"
|
||||||
|
class="btn btn-success edit-question-dataset {% if not element.entries %} disabled {% endif %}"
|
||||||
|
data-id="{{ element.id }}"
|
||||||
|
data-action="analyse"
|
||||||
|
title="Analyse Answers"
|
||||||
|
>
|
||||||
|
<i class="bi bi-search button-icon"></i>
|
||||||
|
</a>
|
||||||
<a
|
<a
|
||||||
href="javascript:void(0)"
|
href="javascript:void(0)"
|
||||||
class="btn btn-primary edit-question-dataset"
|
class="btn btn-primary edit-question-dataset"
|
||||||
@ -63,7 +72,7 @@
|
|||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
href="javascript:void(0)"
|
href="javascript:void(0)"
|
||||||
class="btn btn-primary view-question-dataset"
|
class="btn btn-primary edit-question-dataset"
|
||||||
data-id="{{ element.id }}"
|
data-id="{{ element.id }}"
|
||||||
data-action="view"
|
data-action="view"
|
||||||
title="View Questions"
|
title="View Questions"
|
||||||
|
@ -162,7 +162,7 @@
|
|||||||
{% include "admin/components/client-alerts.html" %}
|
{% include "admin/components/client-alerts.html" %}
|
||||||
</div>
|
</div>
|
||||||
<div class="container justify-content-center">
|
<div class="container justify-content-center">
|
||||||
<div class="row">
|
<div class="my-3 row">
|
||||||
{% if test.start_date <= now %}
|
{% if test.start_date <= now %}
|
||||||
<a href="#" class="btn btn-warning test-action {% if test.end_date < now %}disabled{% endif %}" data-action="end" data-id="{{ test.id }}">
|
<a href="#" class="btn btn-warning test-action {% if test.end_date < now %}disabled{% endif %}" data-action="end" data-id="{{ test.id }}">
|
||||||
<i class="bi bi-hourglass-bottom button-icon"></i>
|
<i class="bi bi-hourglass-bottom button-icon"></i>
|
||||||
@ -174,6 +174,16 @@
|
|||||||
Start Exam
|
Start Exam
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
class="btn btn-success test-analyse test-action {% if not test.entries %} disabled {% endif %}"
|
||||||
|
data-id="{{test.id}}"
|
||||||
|
title="Analyse Exam"
|
||||||
|
data-action="analyse"
|
||||||
|
>
|
||||||
|
<i class="bi bi-search button-icon"></i>
|
||||||
|
Analyse Exam
|
||||||
|
</a>
|
||||||
<a href="#" class="btn btn-danger test-action" data-action="delete" data-id="{{ test.id }}">
|
<a href="#" class="btn btn-danger test-action" data-action="delete" data-id="{{ test.id }}">
|
||||||
<i class="bi bi-file-earmark-excel-fill button-icon"></i>
|
<i class="bi bi-file-earmark-excel-fill button-icon"></i>
|
||||||
Delete Exam
|
Delete Exam
|
||||||
|
@ -58,6 +58,15 @@
|
|||||||
{{ test.entries|length }}
|
{{ test.entries|length }}
|
||||||
</td>
|
</td>
|
||||||
<td class="row-actions">
|
<td class="row-actions">
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
class="btn btn-success test-analyse test-action {% if not test.entries %} disabled {% endif %}"
|
||||||
|
data-id="{{test.id}}"
|
||||||
|
title="Analyse Exam"
|
||||||
|
data-action="analyse"
|
||||||
|
>
|
||||||
|
<i class="bi bi-search button-icon"></i>
|
||||||
|
</a>
|
||||||
<a
|
<a
|
||||||
href="#"
|
href="#"
|
||||||
class="btn btn-primary test-action"
|
class="btn btn-primary test-action"
|
||||||
|
@ -110,6 +110,27 @@ function parse_data(data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Analyse Button
|
||||||
|
$('.dataset-analyse').click(function(event) {
|
||||||
|
|
||||||
|
let id = $(this).data('id')
|
||||||
|
|
||||||
|
$.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()
|
||||||
|
})
|
||||||
|
|
||||||
// Fetch data once page finishes loading
|
// Fetch data once page finishes loading
|
||||||
$(window).on('load', function() {
|
$(window).on('load', function() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -100,7 +100,18 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="d-flex justify-content-center">
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
class="btn btn-success dataset-analyse {% if not dataset.entries %} disabled {% endif %}"
|
||||||
|
data-id="{{dataset.id}}"
|
||||||
|
title="Analyse Answers"
|
||||||
|
data-action="analyse"
|
||||||
|
>
|
||||||
|
<i class="bi bi-search button-icon"></i>
|
||||||
|
Analyse Answers
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user