-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix raw problem view when access directly #1799
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,7 +150,10 @@ def get_context_data(self, **kwargs): | |
context['problem_name'] = self.object.name | ||
context['url'] = self.request.build_absolute_uri() | ||
context['description'] = self.object.description | ||
context['math_engine'] = self.request.profile.math_engine | ||
if self.request.profile is not None: | ||
context['math_engine'] = self.request.profile.math_engine | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might still cause error 500 when the user set |
||
else: | ||
context['math_engine'] = "jax" | ||
return context | ||
|
||
def get(self, request, *args, **kwargs): | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm confused. Why do we need to define a
math_engine
here in the first place? What's wrong with usingMATH_ENGINE
in https://github.com/DMOJ/online-judge/blob/master/judge/template_context.py#L122?cc @int-y1.
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 fact that we don't use
RequestContext
when rendering PDFs and the math engine depends on the PDF rendering backend?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.
I thought
math_engine
was needed for https://github.com/DMOJ/online-judge/blob/master/templates/problem/raw.html#L82There 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.
I guess what I meant is why are we using
math_engine
here instead of changing everything toMATH_ENGINE
. In this view,RequestContext
is used, so we can get rid of this line (which isn't correct as there's more logic forauto
in https://github.com/DMOJ/online-judge/blob/master/judge/template_context.py#L122 than in here). InProblemPDFView
we can renamemath_engine
toMATH_ENGINE
.