Add backend for resolver

This commit is contained in:
cuom1999 2022-12-20 05:27:04 -06:00
parent 793ccb52fd
commit 36007e86ed
8 changed files with 156 additions and 18 deletions

View file

@ -22,7 +22,7 @@
{{ make_tab_item('ranking', 'fa fa-bar-chart', None, _('Hidden Rankings')) }}
{% endif %}
{% endif %}
{% if request.user.is_superuser %}
{% if request.user.is_superuser and can_use_resolver %}
{{ make_tab_item('resolver', 'fa fa-check', url('resolver', contest.key), _('Resolver')) }}
{% endif %}
{% if can_edit %}

View file

@ -7,18 +7,15 @@
var speed = 700;
var autopress = false;
$(document).ready(function() {
$.getJSON('{{ contest_json }}', function (data) {
console.log("OK");
var resolver = new Resolver(data.problem_sub, data.sub_frozen, data.problems, data.users);
window.resolver = resolver;
resolver.calcOperations();
resolver.frozen_op = resolver.operations.length - 1;
resetCSS();
light_theme();
show_rank();
}).fail(function(){
console.log("An error has occurred.");
});
let data = {{ contest_json }};
console.log("OK");
var resolver = new Resolver(data.problem_sub, data.sub_frozen, data.problems, data.users);
window.resolver = resolver;
resolver.calcOperations();
resolver.frozen_op = resolver.operations.length - 1;
resetCSS();
light_theme();
show_rank();
});
function updateSelector() {
@ -74,6 +71,7 @@
tmp.problem[operation.problem_index].old_verdict = operation.new_verdict;
tmp.problem[operation.problem_index].new_verdict = 'NA';
tmp.problem[operation.problem_index].old_point = operation.new_point;
tmp.score = round2(tmp.score);
$('#rank-' + operation.user_id + ' .p-' + operation.problem_index + ' .pro-score').removeClass('selected');
$('#rank-' + operation.user_id + ' .p-' + operation.problem_index + ' .pro-score').addClass(resolver.status(tmp.problem[operation.problem_index]));
$('#rank-' + operation.user_id + ' .score').text(tmp.score);
@ -124,6 +122,7 @@
tmp.problem[operation.problem_index][operation.problem_sub].old_verdict = operation.new_verdict;
tmp.problem[operation.problem_index][operation.problem_sub].new_verdict = 'NA';
tmp.problem[operation.problem_index].old_point += operation.new_point - operation.old_point;
tmp.problem[operation.problem_index].old_point = round2(tmp.problem[operation.problem_index].old_point);
tmp.problem[operation.problem_index][operation.problem_sub].old_point = operation.new_point;
$('#rank-' + operation.user_id + ' .p-' + operation.problem_index + ' .pro-score').text(tmp.problem[operation.problem_index].old_point);
$('#rank-' + operation.user_id + ' .p-' + operation.problem_index + '.s-' + operation.problem_sub + ' .p-content').text(operation.new_point);

View file

@ -8,7 +8,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{{ static('bootstrap/bootstrap.min.css') }}">
<link rel="stylesheet" href="{{ static('resolver.css') }}">
<link rel="shortcut icon" href="#">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">