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

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

Open
MrSerth opened this issue Sep 3, 2024 · 5 comments
Open

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

MrSerth opened this issue Sep 3, 2024 · 5 comments
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!

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

No branches or pull requests

2 participants