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 Paste code to submit feature #2712

Closed
wants to merge 17 commits into from

Conversation

as6325400
Copy link
Contributor

Sorry, I accidentally closed the PR due to some GitHub operation error. I have resubmitted it. Apologies for the inconvenience.

Modify the old PR

Add two features: the ability to view the first failed test case and to copy and paste code directly.

Motivation:

As for the process of uploading code as files, I often find it a bit inconvenient. In online judges like Codeforces and Luogu, there are features allowing users to paste code directly. I believe this is a very convenient feature to have.

Implementation:

  1. A navigation tab is provided for users to choose between uploading a file or pasting code.

2. Configuration setting

截圖 2024-09-22 凌晨2 57 34

vmcj and others added 16 commits July 22, 2024 16:03
We now track the autoload_runtime file and create it as
the normal user and because it exists we don't recreate it in the
install-domserver step as root (assuming it runs with `sudo`). It will
still create it if it doesn't exist, because domserver is a dependency for
install-domserver (and in that case `composer` would run as root again,
so prompting the user to accept this risk).

This also works for the inplace targets as those depend on `build`
which runs the `domserver` part.

(cherry picked from commit b404383)
This triggered an error and broke the webstandard test.

(cherry picked from commit 6862840)
The authentication fails so needs to be rewritten with the new github
action.
It seems Python complains about this for some Python versions.
This reverts commit 0219d8e.

(cherry picked from commit 98c29f7)
In main this file already uses another image so composer was missing.
The native password module used was deprecated with MySQL8 and doesn't work with MySQL9
anymore. It seems we don't need it anymore (I think we needed it because
the mariadb-utils did not have support for caching_sha2_password yet), but the alternative is to
keep using the MySQL8 container and not test for MySQL9.

Under the hood in the past we used to store the password as a hash in
the mysql.user table and now it's stored in another way
(https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password)
which should also give better performance.

See: https://dba.stackexchange.com/a/209520
(cherry picked from commit 9c2bb99)
Fixes DOMjudge#2646.

We used to persist the entity both before and after calling the lifecycle callbacks ourselves, which would introduce weird behavior where Doctrine wanted to insert some rows twice.
By not persisting before calling the callbacks ourselves, this issue goes away.

(cherry picked from commit 9f12b77)
@nickygerritsen
Copy link
Member

For python the entry point is going to be weird, since it needs to be the filename, which is dynamically generated. We should come up with something smart here

@as6325400
Copy link
Contributor Author

For python the entry point is going to be weird, since it needs to be the filename, which is dynamically generated. We should come up with something smart here

I have tested Python, and there is no issue. I believe the Paste code feature can only be used with a single file, so when it's just one file, the Python entry point shouldn't be a problem, right?

@nickygerritsen
Copy link
Member

For python the entry point is going to be weird, since it needs to be the filename, which is dynamically generated. We should come up with something smart here

I have tested Python, and there is no issue. I believe the Paste code feature can only be used with a single file, so when it's just one file, the Python entry point shouldn't be a problem, right?

I think this depends on if you enable "require entry point" for python. If you do it might break

@as6325400
Copy link
Contributor Author

For python the entry point is going to be weird, since it needs to be the filename, which is dynamically generated. We should come up with something smart here

I have tested Python, and there is no issue. I believe the Paste code feature can only be used with a single file, so when it's just one file, the Python entry point shouldn't be a problem, right?

I think this depends on if you enable "require entry point" for python. If you do it might break

Alright, I'm not familiar with Python, so I didn't consider that.

Perhaps we could set up an option that allows the administrator to decide whether to enable the paste code feature. Do you think this would be a good approach?

@nickygerritsen
Copy link
Member

I was thinking maybe to either:

  • ask the user how to name the file
  • do something consistent with the filename and special case python

@as6325400
Copy link
Contributor Author

I was thinking maybe to either:

  • ask the user how to name the file
  • do something consistent with the filename and special case python

I don't quite understand in what situations Python would have issues. Could you provide me with an example problem using Python?

Thanks.

@nickygerritsen
Copy link
Member

I was thinking maybe to either:

  • ask the user how to name the file
  • do something consistent with the filename and special case python

I don't quite understand in what situations Python would have issues. Could you provide me with an example problem using Python?

Thanks.

Can you try to enable "require entry point" for the python language in the jury and try to submit? Let's see what happens. Maybe it's fine

@as6325400
Copy link
Contributor Author

"require entry point"

If enabling the "require entry point" in Python causes issues, would it be feasible to design the system so that, when using Python and the paste_code feature, the code for such cases is specifically saved with a designated filename? Thank you.

@nickygerritsen
Copy link
Member

"require entry point"

If enabling the "require entry point" in Python causes issues, would it be feasible to design the system so that, when using Python and the paste_code feature, the code for such cases is specifically saved with a designated filename? Thank you.

That was my option 2. If you can make it nicely I think that's ok

@as6325400
Copy link
Contributor Author

"require entry point"

If enabling the "require entry point" in Python causes issues, would it be feasible to design the system so that, when using Python and the paste_code feature, the code for such cases is specifically saved with a designated filename? Thank you.

That was my option 2. If you can make it nicely I think that's ok

I have modified my code to force the entry point to equal the filename when using paste_code, since there's only one file in that case. I've tested it, and no issues occurred. Thanks!

@meisterT
Copy link
Member

You probably want to change the merge target to the main branch.

@as6325400 as6325400 changed the base branch from 8.3 to main September 22, 2024 14:21
@as6325400
Copy link
Contributor Author

You probably want to change the merge target to the main branch.

Thank you for pointing that out! I've already changed the merge target to the main branch.

@vmcj
Copy link
Member

vmcj commented Sep 23, 2024

I think you want to do a rebase against main first, you're now adding commits which should stay 8.3.1 specific.

@as6325400
Copy link
Contributor Author

I think you want to do a rebase against main first, you're now adding commits which should stay 8.3.1 specific.

I have made the changes and submitted a new PR

@as6325400 as6325400 closed this Sep 23, 2024
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.

7 participants