checkpoint

This commit is contained in:
Egor Matveev
2021-09-05 15:28:24 +03:00
parent 1307c16ec1
commit 807c52bf2b
30 changed files with 394 additions and 26 deletions

View File

@@ -87,4 +87,25 @@
<button type="submit" class="btn btn-light">Сменить пароль</button>
</form>
{% endif %}
{% if owner %}
<hr><hr>
<h2>Уведомления</h2>
<form method="POST">
{% csrf_token %}
<input type="hidden" name="action" value="notifications">
<input type="text" name="chat_id" value="{{ user.userinfo.telegram_chat_id }}" placeholder="telegram chat id"> <a class="btn btn-link" target="_blank" rel="noopener noreferrer" href="https://t.me/sprint_notifications_bot">Бот</a>
<table>
<tr>
<td style="width: 200px;">
Результаты решений
</td>
<td>
<input type="checkbox" name="notification_solution_result" {% if user.userinfo.notification_solution_result %}checked{% endif %}>
</td>
</tr>
</table>
<button type="submit" class="btn btn-light" style="margin-top: 15px;"><i class="fa fa-save"></i> Сохранить</button>
</form>
{% endif %}
{% endblock %}

View File

@@ -24,6 +24,10 @@
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
</script>
<link rel="stylesheet"
href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.2.0/build/styles/default.min.css">
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.2.0/build/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
<script type="text/javascript" src={% static "js/scripts.js" %}></script>
<style type="text/css">
.center {
@@ -65,6 +69,8 @@
}
.button-right {
display: flex;
position: absolute;
right:10%;
}
.task-settings-input {
width: 50%;
@@ -74,9 +80,10 @@
resize: none;
}
@media screen and (max-width: 700px){
@media screen and (max-width: 1200px){
.header-button {
width:50px;
width:140px;
font-size: 15px;
}
}
{% block styles %}{% endblock %}

View File

@@ -19,7 +19,7 @@
onclick="window.location.href='/rating'">
<i class="fa fa-arrow-up"></i> Рейтинг
</button>
<div class="button-right" style="margin-top: -35px;">
<div class="button-right">
<button class="btn btn-light header-button"
onclick="window.location.href='/account'">
<i class="fa fa-user"></i> Аккаунт

46
templates/solution.html Normal file
View File

@@ -0,0 +1,46 @@
{% extends 'base_main.html' %}
{% block main %}
<h4>
<table class="table" style="width: 30%;">
<tr>
<td>
Id решения
</td>
<td>
{{ solution.id }}
</td>
</tr>
<tr>
<td>
Задача
</td>
<td>
<a href="/task?task_id={{ solution.task.id }}">{{ solution.task.name }}</a>
</td>
</tr>
<tr>
<td>
Язык
</td>
<td>
<img src="{{ solution.language.logo.url }}" width="30px" height="30px">
</td>
</tr>
<tr>
<td>
Результат
</td>
<td>
<span class="badge badge-{% if solution.result == in_queue_status %}secondary{% else %}{% if solution.result == ok_status %}success{% else %}{% if solution.result == testing_status %}info{% else %}danger{% endif %}{% endif %}{% endif %}">{% if solution.result == testing_status %}<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="circle-notch" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="width: 20px;" class="svg-inline--fa fa-circle-notch fa-w-16 fa-spin fa-lg"><path fill="currentColor" d="M288 39.056v16.659c0 10.804 7.281 20.159 17.686 23.066C383.204 100.434 440 171.518 440 256c0 101.689-82.295 184-184 184-101.689 0-184-82.295-184-184 0-84.47 56.786-155.564 134.312-177.219C216.719 75.874 224 66.517 224 55.712V39.064c0-15.709-14.834-27.153-30.046-23.234C86.603 43.482 7.394 141.206 8.003 257.332c.72 137.052 111.477 246.956 248.531 246.667C393.255 503.711 504 392.788 504 256c0-115.633-79.14-212.779-186.211-240.236C302.678 11.889 288 23.456 288 39.056z" class=""></path></svg> {% endif %}{{ solution.result }}</span>
</td>
</tr>
</table>
</h4>
<h4>Файлы решения</h4>
{% for entity in solution.files %}
<h5>{{ entity.filename }}</h5>
<pre><code class="{{ entity.highlight }}" style="border: 1px solid black;">{{ entity.text }}</code></pre>
<hr>
{% endfor %}
{% endblock %}

View File

@@ -1,7 +1,7 @@
{% for solution in solutions %}
<tr>
<td>
<b><a href="">{{ solution.id }}</a></b>
<b><a href="/solution?solution_id={{ solution.id }}">{{ solution.id }}</a></b>
</td>
<td>
{{ solution.time_sent }}

View File

@@ -19,24 +19,31 @@
}
function doPoll() {
jQuery.get('/solutions_table?task_id={{ task.id }}', function(data) {
if (data == 'done') {
return
}
else {
document.getElementById('solutions').innerHTML = data;
jQuery.get('/task_runtime?task_id={{ task.id }}', function(data1) {
if (data == 'done' && data1 == 'done')
return
if (data != 'done') {
document.getElementById('solutions').innerHTML = data;
}
if (data1 != 'done') {
document.getElementById('runtime').innerHTML = data1;
}
setTimeout(function() {doPoll()}, 2000);
}
})
})
jQuery.get('/solutions_table?task_id={{ task.id }}&render=true', function(data) {
jQuery.get('/solutions_table?id={{ task.id }}&render=true', function(data) {
document.getElementById('solutions').innerHTML = data;
})
jQuery.get('/task_runtime?id={{ task.id }}&render=true', function(data) {
document.getElementById('runtime').innerHTML = data;
})
}
{% endblock %}
{% block onload %}doPoll(){% endblock %}
{% block main %}
<h2>{{ task.name }}</h2>
<div id="runtime"></div>
{% if task.legend %}
<h4>Легенда</h4>
{% autoescape off %}
@@ -64,6 +71,40 @@
{{ task.specifications }}
{% endautoescape %}
<hr>
{% endif %}
{% if task.samples %}
<h4 style="">Примеры</h4>
{% for sample in task.samples %}
<h5>Пример {{ sample.num }}</h5>
<b>
<table style="width: 100%">
<tr>
<td>
Входные данные
</td>
<td>
Выходные данные
</td>
</tr>
</table>
</b>
<hr>
<table style="width: 100%;">
<tr>
<td style="width: 50%; vertical-align: top;">
<pre>
{{ sample.input }}
</pre>
</td>
<td style="width: 50%; vertical-align: top;">
<pre>
{{ sample.output }}
</pre>
</td>
</tr>
</table>
<hr>
{% endfor %}
{% endif %}
<h2>Отправить решение</h2>
<table style="margin-bottom: 10px;">

View File

@@ -0,0 +1 @@
<h2>{{ task.name }}<span style="margin-left: 15px;" class="badge badge-{% if progress.finished %}success{% else %}danger{% endif %}">{{ progress.time }}</span></h2>

View File

@@ -74,6 +74,14 @@
<input type="text" name="time_limit" value="{{ task.time_limit }}" class="task-settings-input">
</td>
</tr>
<tr>
<td>
Оценка времени решения (мин)
</td>
<td>
<input type="text" name="time_estimation" value="{{ task.time_estimation }}" class="task-settings-input">
</td>
</tr>
</table>
<button type="submit" class="btn btn-light" style="margin-top: 15px;"><i class="fa fa-save"></i> Сохранить</button>
</form>
@@ -93,8 +101,40 @@
<td>
{% for test in task.tests %}
<div id="file_{{ test.id }}">
<i class="fa fa-file"></i> <button class="btn btn-link" {% if not test.readable %}style="color: red;"{% endif %}>{{ test.filename }}</button><button class="btn btn-link" style="color: black;" onclick="deleteFile({{ test.id }});"><i class="fa fa-times"></i> </button><br>
<i class="fa fa-file"></i> <button class="btn btn-link" {% if not test.readable %}style="color: red;" {% else %}data-toggle="modal" data-target="#filesModalLong{{ test.id }}"{% endif %}>{{ test.filename }}</button><button class="btn btn-link" style="color: black;" onclick="deleteFile({{ test.id }});"><i class="fa fa-times"></i> </button><br>
{% if test.readable %}
<form method="POST">{% csrf_token %}
<!-- Modal -->
<div class="modal fade bd-example-modal-lg" id="filesModalLong{{ test.id }}" tabindex="-1" role="dialog" aria-labelledby="filesModalLongTitle{{ test.id }}" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="filesModalLongTitle{{ test.id }}">{{ test.filename }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<textarea cols="82" rows="30" name="text">{{ test.text }}</textarea>
</div>
</div>
</div>
</div>
<div class="modal-footer">
{% if test.can_be_sample %}Использовать как пример <input type="checkbox" name="is_sample" {% if test.is_sample %}checked{% endif %}>{% endif %}
<button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
<input name="action" value="save_test" type="hidden">
<input name="test_id" value="{{ test.id }}" type="hidden">
<button type="submit" class="btn btn-primary"><i class="fa fa-save"></i> Save</button>
</div>
</div>
</div>
</div>
</form>
{% endif %}
{% endfor %}
<input type="file" style="display: none;" form="form_test_upload" onchange="this.form.submit();" class="btn form-control-file" id="test-upload" value="Выбрать файл" name="file">
<label for="test-upload" class="btn btn-primary"><i class="fa fa-upload"></i> Загрузить тесты</label><button style="margin-left: 10px; margin-top: -8px;" class="btn btn-success" data-toggle="modal" data-target="#exampleModalLongnewtest" onclick="setActionCreate('create_test');"><i class="fa fa-plus"></i></button>