Skip to content

Import task: Handle exercises without tests / model solution files #2503

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

Open
MrSerth opened this issue Sep 3, 2024 · 7 comments · May be fixed by #2867
Open

Import task: Handle exercises without tests / model solution files #2503

MrSerth opened this issue Sep 3, 2024 · 7 comments · May be fixed by #2867
Labels
bug ruby Pull requests that update Ruby code

Comments

@MrSerth
Copy link
Member

MrSerth commented Sep 3, 2024

When importing a ProFormA task that contains a test but without a test file or alternatively a model solution without a model solution file, CodeOcean throws an error.

Most likely, the error is caused through these two lines:

task_files.delete(test_object.files.first.id).tap do |file|

task_files.delete(model_solution_object.files.first.id).tap do |file|

Here, we are accessing the ID of the first file for both, but don't handle the case where no file exists.

@MrSerth MrSerth added bug ruby Pull requests that update Ruby code labels Sep 3, 2024
@kkoehn
Copy link
Contributor

kkoehn commented Mar 4, 2025

A model-solution without files is not allowed by the schema and importing tests without files does not error anymore (there were some refactors in the meantime).

@kkoehn kkoehn closed this as completed Mar 4, 2025
@MrSerth
Copy link
Member Author

MrSerth commented Mar 4, 2025

... importing tests without files does not error anymore

For me, it still errors with 03c71f4 and openHPI/codeharbor@0863898. Here is an example I've exported from CodeHarbor: task_898.zip

Image

@kkoehn
Copy link
Contributor

kkoehn commented Mar 4, 2025

The problem with the mentioned task is a missing description, which is validated for presence by CO. The validation could be conditionalized like for execution_environment to make the import more robust.

@MrSerth
Copy link
Member Author

MrSerth commented Mar 4, 2025

The problem with the mentioned task is a missing description, which is validated for presence by CO. The validation could be conditionalized like for execution_environment to make the import more robust.

Ah, right! I double-checked, and having a validation is enough to perform the import successfully. Then, yes, a more robust import would be great. I would also be fine to add a description (like the title) if missing. 😇

@MrSerth
Copy link
Member Author

MrSerth commented Apr 4, 2025

@kkoehn Feel free to set the description to the same value as the title (if the description is otherwise blank) and close this issue. Thanks!

@kkoehn
Copy link
Contributor

kkoehn commented May 5, 2025

I added that in #2867

@kkoehn kkoehn linked a pull request May 5, 2025 that will close this issue
@MrSerth
Copy link
Member Author

MrSerth commented May 5, 2025

Awesome, thank you! I am confident that the PR #2867 will fix the issue (based on a short glimpse at the code), so that we can close it once merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ruby Pull requests that update Ruby code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants