registration implemented
This commit is contained in:
@@ -1,315 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% load filters %}
|
||||
|
||||
{% block title %}{{ Block.name }} | решения{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
function filter() {
|
||||
const idi = document.getElementById('idi').value;
|
||||
const task = document.getElementById('task_name').value;
|
||||
const user = document.getElementById('user').value;
|
||||
const group = document.getElementById('group').value;
|
||||
const last_solution = document.getElementById('last_solution').checked;
|
||||
const best_result = document.getElementById('best_result').checked;
|
||||
const only_students = document.getElementById('only_students').checked;
|
||||
const not_seen = document.getElementById('not_seen').checked;
|
||||
var req = '';
|
||||
if (idi) {
|
||||
req += '&solution_id=' + idi;
|
||||
}
|
||||
if (not_seen) {
|
||||
req += '¬_seen=' + not_seen;
|
||||
}
|
||||
if (task) {
|
||||
req += '&task_name=' + task;
|
||||
}
|
||||
if (user) {
|
||||
req += '&user=' + user;
|
||||
}
|
||||
if (group) {
|
||||
req += '&group=' + group;
|
||||
}
|
||||
if (last_solution) {
|
||||
req += '&last_solution=' + last_solution;
|
||||
}
|
||||
if (best_result) {
|
||||
req += '&best_result=' + best_result;
|
||||
}
|
||||
if (only_students) {
|
||||
req += '&only_students=' + only_students;
|
||||
}
|
||||
window.location.href = '/admin/solutions?block_id={{ Block.id }}' + req;
|
||||
}
|
||||
function retest() {
|
||||
let del = confirm("Подтвердите перетест");
|
||||
if (del)
|
||||
window.location.href = '/admin/retest?block_id={{ Block.id }}{% autoescape off %}{{ req }}{% endautoescape %}';
|
||||
}
|
||||
function download() {
|
||||
let del = confirm("Подтвердите скачивание");
|
||||
if (del) {
|
||||
window.location.href = '/admin/download?block_id={{ Block.id }}{% autoescape off %}{{ req }}{% endautoescape %}';
|
||||
}
|
||||
}
|
||||
function showHideTests() {
|
||||
var text = document.getElementById('tests_text');
|
||||
var button = document.getElementById('tests_button');
|
||||
text.hidden = !text.hidden;
|
||||
if (text.hidden) {
|
||||
button.textContent = 'Показать тесты';
|
||||
} else {
|
||||
button.textContent = 'Скрыть тесты';
|
||||
}
|
||||
}
|
||||
function showHideLog() {
|
||||
var text = document.getElementById('log_text');
|
||||
var button = document.getElementById('log_button');
|
||||
text.hidden = !text.hidden;
|
||||
if (text.hidden) {
|
||||
button.textContent = 'Показать лог';
|
||||
} else {
|
||||
button.textContent = 'Скрыть лог';
|
||||
}
|
||||
}
|
||||
function fillModalResults(id) {
|
||||
jQuery.get('/get_result_data?id=' + id, function(data) {
|
||||
const response = JSON.parse(data);
|
||||
if (response['success'] == true) {
|
||||
document.getElementById('resultModalLongTitle').innerHTML = 'Подробная информация о тестировании ' + id;
|
||||
document.getElementById('results_text').innerHTML = response['results_text'];
|
||||
document.getElementById('tests_text').innerHTML = '<h4>Тесты</h4><br>' + response['tests_text'];
|
||||
document.getElementById('log_text').innerHTML = '<h4>Лог</h4><br>' + response['log_text'];
|
||||
}
|
||||
});
|
||||
}
|
||||
function fillModalComments(id) {
|
||||
jQuery.get('/get_comment_data?id=' + id, function(data) {
|
||||
const response = JSON.parse(data);
|
||||
if (response['success'] == true) {
|
||||
document.getElementById('commentModalLongTitle').innerHTML = 'Комментарий к решению ' + id;
|
||||
document.getElementById('comment_text').innerHTML = response['comment_text'];
|
||||
}
|
||||
});
|
||||
}
|
||||
{% endblock %}
|
||||
|
||||
{% block styles %}
|
||||
.input_field {
|
||||
width: 500px;
|
||||
}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="resultModalLong" tabindex="-1" role="dialog" aria-labelledby="resultModalLongTitle" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="resultModalLongTitle"></h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div id="results_text"></div>
|
||||
<hr>
|
||||
<pre id="tests_text" hidden></pre>
|
||||
<hr>
|
||||
<pre id="log_text" hidden></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" id="log_button" class="btn btn-warning" onclick="showHideLog()">Показать лог</button>
|
||||
<button type="button" id="tests_button" class="btn btn-primary" onclick="showHideTests()">Показать тесты</button>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="commentModalLong" tabindex="-1" role="dialog" aria-labelledby="commentModalLongTitle" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="commentModalLongTitle"></h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<pre id="comment_text"></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2><a href="/admin/block?id={{ Block.id }}">{{ Block.name }}</a></h2>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<h4>Фильтр</h4>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Id</td>
|
||||
<td><input class="input_field" type="text" placeholder="Id" id="idi" name="idi" value="{{ options.solution_id }}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Таск</td>
|
||||
<td>
|
||||
<select class="input_field" id="task_name" name="task_name">
|
||||
<option value="">Все</option>
|
||||
{% for task in solutions_info.tasks %}
|
||||
<option value="{{ task.name }}" {% if options.task_name == task.name %}selected{% endif %}>{{ task.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Пользователь</td>
|
||||
<td>
|
||||
<select class="input_field" id="user" name="user">
|
||||
<option value="">Все</option>
|
||||
{% for u in solutions_info.users %}
|
||||
<option value="{{ u }}" {% if options.user == u %}selected{% endif %}>{{ u }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Группа</td>
|
||||
<td>
|
||||
<select class="input_field" id="group" name="group">
|
||||
<option value="">Все</option>
|
||||
{% for group in solutions_info.groups %}
|
||||
<option value="{{ group }}" {% if options.group == group %}selected{% endif %}>{{ group }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Последнее решение</td>
|
||||
<td><input type="checkbox" id="last_solution" name="last_solution" {% if options.last_solution %}checked{% endif %}>{{ option.last_solution }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Лучший результат</td>
|
||||
<td><input type="checkbox" id="best_result" name="best_result" {% if options.best_result %}checked{% endif %}></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Только студенты</td>
|
||||
<td><input type="checkbox" id="only_students" name="only_students" {% if options.only_students %}checked{% endif %}></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Еще не проверено</td>
|
||||
<td><input type="checkbox" id="not_seen" name="not_seen" {% if options.not_seen %}checked{% endif %}></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<button type="button" class="btn btn-dark" id="control" onclick="filter()" style="margin-top: 20px;"><i class="fa fa-check"></i> Применить</button><br>
|
||||
<button type="button" class="btn btn-dark" id="control" onclick="window.location.href='/admin/solutions?block_id={{ Block.id }}'" style="margin-top: 10px;"><i class="fa fa-times"></i> Сбросить</button><br>
|
||||
<button style="margin-top: 10px;" class="btn btn-dark" onclick="download()"><i class="fa fa-download"></i> Скачать решения</button><br>
|
||||
<button style="margin-top: 10px;" class="btn btn-dark" onclick="retest()"><i class="fa fa-undo"></i> Перетест</button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<h4>Статистика по таскам</h4>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th scope="col">Таск</th>
|
||||
<th scope="col">Верно</th>
|
||||
<th scope="col">Частично</th>
|
||||
<th scope="col">С ошибкой</th>
|
||||
<th scope="col">Все</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for task in Block.tasks %}
|
||||
<tr>
|
||||
<th scope="row">{{ task.name }}</th>
|
||||
<td>{{ task.correct_count }}</td>
|
||||
<td>{{ task.partially_passed }}</td>
|
||||
<td>{{ task.solutions_with_error }}</td>
|
||||
<td>{{ task.solutions_count }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<hr>
|
||||
<h5>Решения</h5>
|
||||
<form method="POST" id="delete_form">
|
||||
{% csrf_token %}
|
||||
</form>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">id</th>
|
||||
<th scope="col">Таск</th>
|
||||
<th scope="col">Пользователь</th>
|
||||
<th scope="col">Время отправки</th>
|
||||
<th scope="col">Группа</th>
|
||||
<th scope="col">Результат</th>
|
||||
<th scope="col">Оценка</th>
|
||||
<th scope="col">Комментарий</th>
|
||||
<th scope="col">Действия</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for solution in solutions %}
|
||||
<tr style="background-color: {% if solution.result == 'TESTING' %}#FFE2B7{% else %}{% if solution.result == 'IN QUEUE' %}#EAEAFF{% endif %}{% endif %};">
|
||||
<th scope="row">
|
||||
<a href="/admin/solution?id={{ solution.id }}&solutions={{ filter }}">{{ solution.id }}</a>
|
||||
</th>
|
||||
<td>
|
||||
<a href="/admin/task?id={{ solution.task.id }}">{{ solution.task.name }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ solution.userinfo.surname }} {{ solution.userinfo.name }} {{ solution.userinfo.middle_name }}
|
||||
</td>
|
||||
<td>
|
||||
{{ solution.time_sent }}
|
||||
</td>
|
||||
<td>
|
||||
{{ solution.userinfo.group }}
|
||||
</td>
|
||||
<td>
|
||||
<!-- Button trigger modal -->
|
||||
<button type="button" class="btn btn-link" data-toggle="modal" data-target="#resultModalLong" onclick="fillModalResults({{ solution.id }})">
|
||||
{{ solution.result }}
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
{{ solution.mark_property }}
|
||||
</td>
|
||||
<td>
|
||||
{% if solution.comment %}
|
||||
<!-- Button trigger modal -->
|
||||
<button type="button" class="btn btn-link" data-toggle="modal" data-target="#commentModalLong" onclick="fillModalComments({{ solution.id }})">
|
||||
Посмотреть
|
||||
</button>
|
||||
{% else %}
|
||||
<p>Нет комментария</p>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-primary" onclick="window.location.href='/admin/download?block_id={{ Block.id }}&solution_id={{ solution.id }}';"><i class="fa fa-download"></i></button>
|
||||
<button name="DELETE_SOLUTION" form="delete_form" value="{{ solution.id }}" onclick="var del = confirm('Подтвердите удаление');if (del){this.form.submit();}" class="btn btn-danger" type="игеещт"><i class="fa fa-trash"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user