-
Notifications
You must be signed in to change notification settings - Fork 81
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
Add a table in problem view to switch problems #361
Conversation
templates/problem/problem.html
Outdated
{% if can_view_all_problems or problem.is_public %} | ||
<a href="{{ url('problem_detail', contest_problem.code) }}"> | ||
{{contest.get_label_for_problem(loop.index0)}} | ||
</a> | ||
{% else %} | ||
{{contest.get_label_for_problem(loop.index0)}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for in-contest problems, they are not public, so the check will always be false, aka the link is not show -> useless
judge/views/problem.py
Outdated
context['contest_problems'] = Problem.objects.filter(contests__contest=contest_problem.contest) \ | ||
.order_by('contests__order').defer('description') \ | ||
.annotate(has_public_editorial=Case( | ||
When(solution__is_public=True, solution__publish_on__lte=timezone.now(), then=True), | ||
default=False, | ||
output_field=BooleanField(), | ||
)) \ | ||
.add_i18n_name(self.request.LANGUAGE_CODE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the query is kinda heavy and we don't need all this infformation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Add a table to switch to problems * optimize query --------- Co-authored-by: Le Duy Thuc <[email protected]>
Description
Type of change: new feature
What
Why
Requested by last year's contestants.
How Has This Been Tested?
Tested on local version of VNOJ.
Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.By submitting this pull request, I confirm that my contribution is made under the terms of the AGPL-3.0 License.