Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display available judges #851

Merged
merged 3 commits into from
Jan 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions judge/views/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
from django_ace.widgets import ACE_URL
from judge.comments import CommentedDetailView
from judge.forms import ProblemSubmitForm
from judge.models import Problem, Submission, ContestSubmission, ContestProblem, Language, ProblemGroup, Solution, \
ProblemTranslation, TranslatedProblemForeignKeyQuerySet, RuntimeVersion, ProblemType
from judge.models import ContestSubmission, ContestProblem, Judge, Language, Problem, ProblemGroup, ProblemTranslation, \
ProblemType, RuntimeVersion, Solution, Submission, TranslatedProblemForeignKeyQuerySet
from judge.pdf_problems import HAS_PDF, DefaultPdfMaker
from judge.utils.diggpaginator import DiggPaginator
from judge.utils.opengraph import generate_opengraph
Expand Down Expand Up @@ -174,6 +174,7 @@ def get_context_data(self, **kwargs):
if contest_problem.max_submissions:
context['submissions_left'] = max(contest_problem.max_submissions - get_contest_submission_count(self.object.code, user.profile), 0)

context['available_judges'] = Judge.objects.filter(online=True, problems=self.object)
context['show_languages'] = self.object.allowed_languages.count() != Language.objects.count()
context['has_pdf_render'] = HAS_PDF
context['completed_problem_ids'] = self.get_completed_problems()
Expand Down
4 changes: 2 additions & 2 deletions resources/problem.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ ul.problem-list {
content: " ";
}

.authors-value {
.authors-value, .judges-value {
padding-left: 1.5em;
}

Expand Down Expand Up @@ -268,4 +268,4 @@ ul.problem-list {
padding: 0 3px;
font-size: 13px;
}
}
}
27 changes: 26 additions & 1 deletion templates/problem/problem.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
min-width: 12.5em;
}

#problem-types, #allowed-langs {
#problem-types, #allowed-langs, #available-judges {
padding-top: 1em;
}

Expand Down Expand Up @@ -238,6 +238,31 @@ <h2 style="color:#393630; display: inline-block">{{ title }}</h2>
</div>
</div>
{% endif %}
{% if problem.is_editable_by(request.user) %}
<div id="available-judges">
<i class="fa fa-database fa-fw"></i><span
class="pi-name">{% trans trimmed count=available_judges|length %}
Judge:
{% pluralize count %}
Judges:
{% endtrans %}
</span>
<div class="pi-value judges-value">
{% if available_judges %}
{% if perms.judge.change_judge %}
{% for judge in available_judges %}
<a href="{{ url('admin:judge_judge_change', judge.id) }}">{{ judge.name }}</a>
{% if not loop.last %}, {% endif %}
{% endfor %}
{% else %}
{{ available_judges|join(", ") }}
{% endif %}
{% else %}
<i>{{ _('none available') }}</i>
{% endif %}
</div>
</div>
{% endif %}
{% endblock %}

{% block description %}
Expand Down