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

Add a table in problem view to switch problems #361

Merged
merged 2 commits into from
Dec 5, 2023

Conversation

jalsol
Copy link
Collaborator

@jalsol jalsol commented Dec 5, 2023

Description

Type of change: new feature

What

image

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.

  • I have explained the purpose of this PR.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the README/documentation
  • Any dependent changes have been merged and published in downstream modules
  • Informed of breaking changes, testing and migrations (if applicable).
  • Attached screenshots (if applicable).

By submitting this pull request, I confirm that my contribution is made under the terms of the AGPL-3.0 License.

Comment on lines 352 to 357
{% 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)}}
Copy link
Contributor

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

Comment on lines 206 to 213
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)
Copy link
Contributor

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

Copy link
Contributor

@leduythuccs leduythuccs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@leduythuccs leduythuccs merged commit 8aa4d53 into icpc23 Dec 5, 2023
@leduythuccs leduythuccs deleted the icpc23-problem-switch branch December 5, 2023 17:12
leduythuccs added a commit that referenced this pull request Oct 18, 2024
* Add a table to switch to problems

* optimize query

---------

Co-authored-by: Le Duy Thuc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants