This commit is contained in:
cuom1999 2022-06-03 14:01:49 -05:00
parent 2ee1885880
commit 1802458408
3 changed files with 26 additions and 217 deletions

View file

@ -512,7 +512,7 @@ class ProblemList(QueryStringSortMixin, TitleMixin, SolvedProblemMixin, ListView
def get_org_query(self, query):
if not self.profile:
return None
return []
return [
i
for i in query
@ -541,6 +541,7 @@ class ProblemList(QueryStringSortMixin, TitleMixin, SolvedProblemMixin, ListView
)
if self.org_query:
self.org_query = self.get_org_query(self.org_query)
print(self.org_query)
queryset = queryset.filter(
Q(organizations__in=self.org_query)
| Q(contests__contest__organizations__in=self.org_query)

View file

@ -55,13 +55,6 @@
<script src="{{ static('libs/nouislider.min.js') }}" type="text/javascript"></script>
<script>
$(function () {
{% if not request.in_contest_mode %}
// wrap middle and write column
if (window.matchMedia('(max-width: 799px)').matches) {
$('.middle-content').next().addBack().wrapAll('<div class="problem-middle-right"/>');
}
{% endif %}
var $form = $('form#filter-form');
var $search = $('#search');
var $category = $('#category');
@ -233,7 +226,9 @@
{% if request.in_contest_mode %}
$('.left-sidebar').hide();
$('.middle-content').css('max-width', '80%');
if (window.matchMedia('(min-width: 800px)').matches) {
$('.middle-content').css('max-width', '80%');
}
{% endif %}
});
</script>
@ -251,195 +246,6 @@
{% endif %}
{% endblock %}
{% block middle_content %}
{% if in_contest_mode or page_type == 'list' %}
<div id="content-left" class="problems">
<table id="problem-table" class="table striped">
<thead>
<tr>
{% if request.in_contest_mode %}
{% if request.user.is_authenticated %}
<th class="solved"><i class="fa fa-check"></i></th>
{% endif %}
<th class="problem">{{ _('Problem') }}</th>
<th class="pcode">{{ _('Problem code') }}</th>
{% if show_types %}
<th>{{ _('Types') }}</th>
{% endif %}
<th class="points">{{ _('Points') }}</th>
<th class="users">{{ _('Users') }}</th>
{% else %}
{% if request.user.is_authenticated %}
<th class="solved">
<a href="{{ sort_links.solved }}"><i class="fa fa-check"></i>{{ sort_order.solved }}
</a>
</th>
{% endif %}
<th class="problem">
<a href="{{ sort_links.name }}">{{ _('Problem') }}{{ sort_order.name }}</a>
</th>
<th class="pcode">
<a href="{{ sort_links.code }}">{{ _('Problem code') }}</a>
</th>
<th class="category">
<a href="{{ sort_links.group }}">{{ _('Category') }}{{ sort_order.group }}</a>
</th>
{% if show_types %}
<th>
<a href="{{ sort_links.type }}">{{ _('Types') }}{{ sort_order.type }}</a>
</th>
{% endif %}
<th class="points">
<a href="{{ sort_links.points }}">{{ _('Points') }}{{ sort_order.points }}</a>
</th>
<th class="ac-rate">
<a href="{{ sort_links.ac_rate }}">{{ _('AC %%') }}{{ sort_order.ac_rate }}</a>
</th>
<th class="users">
<a href="{{ sort_links.user_count }}">{{ _('Users') }}{{ sort_order.user_count }}</a>
</th>
{% if show_editorial %}
<th class="editorial">
{{_('Editorial')}}
</th>
{% endif %}
{% endif %}
</tr>
</thead>
<tbody>
{% for problem in object_list %}
<tr>
{% if request.user.is_authenticated %}
{% if problem.id in completed_problem_ids %}
<td solved="1">
<a href="{{ url('user_submissions', problem.code, request.user.username) }}">
{% if problem.is_public or request.in_contest_mode %}
<i class="solved-problem-color fa fa-check-circle"></i>
{% else %}
<i class="solved-problem-color fa fa-lock"></i>
{% endif %}
</a>
</td>
{% elif problem.id in attempted_problems %}
<td solved="0">
<a href="{{ url('user_submissions', problem.code, request.user.username) }}">
{% if problem.is_public or request.in_contest_mode %}
<i class="attempted-problem-color fa fa-minus-circle"></i>
{% else %}
<i class="attempted-problem-color fa fa-lock"></i>
{% endif %}
</a>
</td>
{% else %}
<td solved="-1">
{% if problem.is_public or request.in_contest_mode %}
<i class="unsolved-problem-color fa fa-minus-circle"></i>
{% else %}
<i class="unsolved-problem-color fa fa-lock"></i>
{% endif %}
</td>
{% endif %}
{% endif %}
<td class="problem">
<a href="{{ url('problem_detail', problem.code) }}">{{ problem.i18n_name }}</a>
</td>
<td class="pcode">
<a class="pcodecell" href="{{ url('problem_detail', problem.code) }}">{{ problem.code }}</a>
</td>
{% if not request.in_contest_mode %}
<td class="category">{{ problem.group.full_name }}</td>
{% endif %}
{% if show_types %}
<td class="types">
{% for type in problem.types_list %}
<span class="type-tag">{{ type }}</span>{% if not loop.last %}, {% endif %}
{% endfor %}
</td>
{% endif %}
<td class="p">{{ problem.points|floatformat }}{% if problem.partial %}p{% endif %}</td>
{% if not request.in_contest_mode %}
<td class="ac-rate">{{ problem.ac_rate|floatformat(1) }}%</td>
{% endif %}
<td class="users">
<a href="{{ url('ranked_submissions', problem.code) }}">
{% if not request.in_contest_mode or not hide_contest_scoreboard %}
{{ problem.user_count }}
{% else %}
???
{% endif %}
</a>
</td>
{% if show_editorial%}
<td class="editorial">
{% if problem.has_public_editorial %}
<a href="{{ url('problem_editorial', problem.code) }}">{{ _('Editorial') }}</a>
{% endif %}
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% if request.in_contest_mode and request.participation.contest.use_clarifications %}
<br><br>
{% if can_edit_contest %}
<div style="float: right; font-size: 1.2em">
<a href="{{url('new_contest_clarification', request.participation.contest.key)}}"><i class="fa fa-plus-circle" style="color:green"></i> <u>{{_('Add clarifications')}}</u></a>
</div>
{% endif %}
{% if has_clarifications %}
<div style="font-size: 1.2em; font-style: bold">
<i class="fa fa-question-circle"></i> {{_('Clarifications')}}</div>
<table class="table">
<tr>
<th>{{_('Problem')}}</th>
<th>{{_('Time')}}</th>
<th>{{_('Description')}}</th>
</tr>
{% for clarification in clarifications %}
<tr>
<td>
<a href="{{ url('problem_detail', clarification.problem.code) }}"
class="problem">
{{ clarification.problem.name }}
</a>
</td>
<td class="time">{{ relative_time(clarification.date) }}</td>
<td><p style="overflow-wrap: break-word; word-break: break-word">{{clarification.description}}</p></td>
</tr>
{% endfor %}
</table>
{% else %}
<p style="font-style: italic; text-align: center">
{{ _('No clarifications have been made at this time.') }}</center>
</p>
{% endif %}
{% endif %}
</div>
{% elif page_type == 'feed' %}
<div class="problem-feed-option">
<a href="{{url('problem_feed')}}" class="problem-feed-option-item {{'active' if feed_type=='for_you'}}">
{{_('FOR YOU')}}
</a>
<a href="{{url('problem_feed_new')}}" class="problem-feed-option-item {{'active' if feed_type=='new'}}">
{{_('NEW')}}
</a>
{% if request.user.has_perm('judge.suggest_problem_changes') %}
<a href="{{url('problem_feed_volunteer')}}" class="problem-feed-option-item {{'active' if feed_type=='volunteer'}}">
{{_('VOLUNTEER')}}
</a>
{% endif %}
</div>
{% for problem in problems %}
{% include "problem/feed.html" %}
{% endfor %}
{% endif %}
{% if page_obj.num_pages > 1 %}
<div style="margin-top:10px;">{% include "list-pages.html" %}</div>
{% endif %}
{% endblock %}
{% block right_sidebar %}
{% if not request.in_contest_mode %}
<div id="content-right" class="problems right-sidebar">

View file

@ -1,20 +1,22 @@
<div class="sidebox">
<h3>{{ _('Last unsolved') }} <i class="fa fa-bullseye"></i>
</h3>
<div class="sidebox-content" style="padding: 0; border: 0">
<table class="table feed-table">
<tbody>
{% for problem in last_attempted_problems %}
<tr>
<td>
<a href="{{ url('problem_detail', problem.code) }}">{{ problem.name }}</a>
</td>
<td>
<a href="{{ url('submission_status', problem.last_submission) }}">{{ problem.last_submission }}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if last_attempted_problems%}
<div class="sidebox">
<h3>{{ _('Last unsolved') }} <i class="fa fa-bullseye"></i>
</h3>
<div class="sidebox-content" style="padding: 0; border: 0">
<table class="table feed-table">
<tbody>
{% for problem in last_attempted_problems %}
<tr>
<td>
<a href="{{ url('problem_detail', problem.code) }}">{{ problem.name }}</a>
</td>
<td>
<a href="{{ url('submission_status', problem.last_submission) }}">{{ problem.last_submission }}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}