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.
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 Paste code to submit feature #2720
base: main
Are you sure you want to change the base?
add Paste code to submit feature #2720
Changes from 6 commits
62985ba
56f076e
aa8ed35
3893628
3376c11
bf9d7bc
add44de
74e36d9
dbe2363
723f8d5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Are these the default or allowed submission methods? Also, it would be good to clarify that these are submission methods from the web interface, as there's also the submit client.
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.
Allowed submission methods, with the default set to upload.
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.
what is submit client?
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.
This: https://raw.githubusercontent.com/DOMjudge/domjudge/refs/heads/main/submit/submit
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.
Instead of hardcoding Java and Kotlin here, use the
$language->getRequireEntryPoint()
instead.Similarly, use
$language->getEntryPointDescription()
for a description to display.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.
We probably want to use what we built here so that the entry point works the same regardless of the upload method: https://github.com/DOMjudge/domjudge/blob/main/webapp/src/Form/Type/SubmitProblemType.php#L66
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.
Sorry, I don't understand how to use $language->getRequireEntryPoint(). For example, in the case of Java, when using paste_code, the entry_point might still be no. In this case, how can I use this to determine the file name standard?
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 think the remark here is that instead of listing the current languages which need an entrypoint, use that function @meisterT linked and use it from there?
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 function should be checking whether the language in the form requires an entrypoint, which seems to be different from my current situation, right?
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.
Why would it be different? You check for 2 languages here and determine the entrypoint for those. If there are other languages like this we would also want to pick them up. People can add more languages besides those 2.
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.
@vmcj
I'm not sure if my understanding is correct, but are the methods $language->getRequireEntryPoint() and $language->getEntryPointDescription() linked to the part I highlighted in the image?
If so, there might be an issue.
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 example, in the case of Java, it can be configured to not require an entry point. In this scenario, under the original upload mode, the uploaded file itself becomes the entry point. However, due to the characteristics of the Java language, the file name must match the main class name.
In the case of the paste code mode, regardless of whether an entry point is required or not, the user must be allowed to specify the main class name. Otherwise, I won’t be able to save the file correctly, which will result in a compile error.
Check failure on line 120 in webapp/src/Controller/Team/SubmissionController.php
GitHub Actions / phpcs
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.
There are some warnings on https://github.com/DOMjudge/domjudge/pull/2720/files which you should still handle.
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.
done
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 still see them:
maybe you have to toggle
a
to see them.Check failure on line 125 in webapp/src/Controller/Team/SubmissionController.php
GitHub Actions / phpcs
Check failure on line 126 in webapp/src/Controller/Team/SubmissionController.php
GitHub Actions / phpcs
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 think we should use a simpler name here (and then of course use that as base for the entry point calculation). A nice simple naming scheme could be the
shortName
of thecontestProblem
.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 still want the pasted submission to have a special identifier in the filename, to differentiate it from uploads. Is it possible to do this?
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.
What is the reason the way of submitting is important? You could test with adding
fileupload-
to the name? You would need to test yourself if this still works.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.
Why is it "fileupload"? I thought it would be something like "Paste."
However, I now think using "shortName" directly is fine too.
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.
If you think the short name as given by the contest problem is ok, let's use that.
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.
Currently, the short name allows various characters. I will still use
preg_replace('/[^a-zA-Z0-9_.-]/', '_', $tempFileName);
to handle file naming using the short name.Check failure on line 174 in webapp/src/Controller/Team/SubmissionController.php
GitHub Actions / phpcs
Check warning on line 175 in webapp/src/Controller/Team/SubmissionController.php
GitHub Actions / phpcs
Check failure on line 177 in webapp/src/Controller/Team/SubmissionController.php
GitHub Actions / phpcs
Check failure on line 179 in webapp/src/Controller/Team/SubmissionController.php
GitHub Actions / phpcs
Check failure on line 78 in webapp/src/Form/Type/SubmitProblemPasteType.php
GitHub Actions / phpcs