Make ioi16 related files cleaner

This commit is contained in:
cuom1999 2023-01-02 17:22:45 -06:00
parent e10a8aca5c
commit 07d5ad2216
14 changed files with 145 additions and 92 deletions

View file

@ -23,7 +23,9 @@
window.show_problem = 0;
{% endif %}
{% endif %}
window.results_json = {{ results_json }};
{% if results_json %}
window.results_json = {{ results_json }};
{% endif %}
</script>
{% compress js %}
@ -85,49 +87,51 @@
});
// Draw the statistics graph.
var chart = null;
function stats_graph(raw_data) {
var colors = {{ results_colors_json }};
{% if results_json %}
var chart = null;
function stats_graph(raw_data) {
var colors = {{ results_colors_json }};
var ctx = $('#status-graph').find('canvas')[0].getContext('2d');
var font = $('body').css('font-family');
if (chart !== null) {
chart.destroy();
var ctx = $('#status-graph').find('canvas')[0].getContext('2d');
var font = $('body').css('font-family');
if (chart !== null) {
chart.destroy();
}
chart = new Chart(ctx, {
type: 'pie',
data: {
datasets: [{
data: raw_data.categories.map(function(entry) {
return entry.count;
}),
backgroundColor: raw_data.categories.map(function(entry) {
return colors[entry.code];
}),
}],
labels: raw_data.categories.map(function(entry) {
return entry.name;
}),
},
options: {
animation: false,
scaleFontFamily: font,
tooltips: {
titleFontFamily: font,
bodyFontFamily: font,
},
legend: {
display: false,
},
},
});
$('#total-submission-count').text(raw_data.total);
}
chart = new Chart(ctx, {
type: 'pie',
data: {
datasets: [{
data: raw_data.categories.map(function(entry) {
return entry.count;
}),
backgroundColor: raw_data.categories.map(function(entry) {
return colors[entry.code];
}),
}],
labels: raw_data.categories.map(function(entry) {
return entry.name;
}),
},
options: {
animation: false,
scaleFontFamily: font,
tooltips: {
titleFontFamily: font,
bodyFontFamily: font,
},
legend: {
display: false,
},
},
$(function () {
stats_graph(window.results_json);
});
$('#total-submission-count').text(raw_data.total);
}
$(function () {
stats_graph(window.results_json);
});
{% endif %}
function load_dynamic_update(last_msg) {
var _collect = function (e) {
@ -323,8 +327,7 @@
{% endblock %}
{% block right_sidebar %}
{% set hide_sidebar = request.in_contest_mode and request.participation.contest.format_name == "ioi16" and not request.user.is_superuser %}
{% if not hide_sidebar %}
{% if results_json %}
<div class="right-sidebar">
<div class="submission">
<div class="sidebox">

View file

@ -1,5 +1,5 @@
{% set can_view = submission_layout(submission, profile_id, request.user, editable_problem_ids, completed_problem_ids) %}
{% set hidden = submission.contest_object and submission.contest_object.format_name == "ioi16" and not request.user.is_superuser %}
{% set hidden = submission.contest_object and submission.contest_object.format.has_hidden_subtasks and not request.user.is_superuser %}
{% if hidden %}
<div class="sub-result TLE">
<div class="score">

View file

@ -26,7 +26,7 @@
{% endif %}
{% for batch in batches %}
{% if batch.id not in frozen_subtasks %}
{% if batch.id not in hidden_subtasks %}
<div style="margin-top: 0.5em;">
{% if batch.id %}
<b>{{ _('Batch ') }}#{{ batch.id }} ({{batch.points|floatformat}} / {{batch.total|floatformat}}): </b>
@ -52,7 +52,7 @@
<br>
<table class="testcases-table">
{% if submission.is_graded and submission.result != 'AB' and not frozen_subtasks %}
{% if submission.is_graded and submission.result != 'AB' and not hidden_subtasks %}
<thead>
<tr id="overall-row" class="case-row overall-result-{{submission.result}}">
<td><span class="col-title">{{_('Overall: ')}}</span>
@ -90,7 +90,7 @@
<tbody>
{% for batch in batches %}
{% if batch.id not in frozen_subtasks %}
{% if batch.id not in hidden_subtasks %}
{% if batch.id %}
{% set batch_AC = (batch.points == batch.total) %}
<tr class="case-row background-{{'d6e8f7' if batch.points == batch.total else 'bisque'}}">