openHPI / codeocean

CodeOcean is an automated assessment tool for web-based coding exercises
BSD 3-Clause "New" or "Revised" License
64 stars 27 forks source link

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

Open MrSerth opened 1 month ago

MrSerth commented 1 month ago

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:

https://github.com/openHPI/codeocean/blob/1e08f2cc9cda8f5f0d49b8543cf25323e0b93e2f/app/services/proforma_service/convert_task_to_exercise.rb#L68

https://github.com/openHPI/codeocean/blob/1e08f2cc9cda8f5f0d49b8543cf25323e0b93e2f/app/services/proforma_service/convert_task_to_exercise.rb#L79

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