ls1intum / Artemis

Artemis - Interactive Learning with Automated Feedback
https://docs.artemis.cit.tum.de
MIT License
459 stars 274 forks source link

Exercises: Solution publication date lost during import #8774

Open b-fein opened 1 month ago

b-fein commented 1 month ago

Describe the bug

When importing a Modelling exercise, you can set various options relating to release/due/… dates when configuring the exercise upon importing it. You can also set the Example Solution Publication Date, but this option is not retained when clicking on ‘Import’.

To Reproduce

  1. ‘Import Modeling Exercise’ in the course management with some exercise.
  2. On the following page, edit the Example Solution Publication Date.
  3. Click Import.
  4. Now the solution publication date is null/undefined.
  5. Other changes made before importing are kept.

Expected behavior

The date can be set directly and is kept upon import.

Screenshots

No response

Which version of Artemis are you seeing the problem on?

7.1.2

What browsers are you seeing the problem on?

Safari, Firefox

Additional context

Might also affect other exercise types, I did only test it with modelling exercises.

Relevant log output

No response

JohannesStoehr commented 1 month ago

This is the relevant code snipped, so this seams to be intended:

newExercise.setStartDate(importedExercise.getStartDate());
newExercise.setReleaseDate(importedExercise.getReleaseDate());
newExercise.setDueDate(importedExercise.getDueDate());
newExercise.setAssessmentDueDate(importedExercise.getAssessmentDueDate());
newExercise.setExampleSolutionPublicationDate(null); // This should not be imported.
newExercise.validateDates();

But I also don't see a reason why we shouldn't change this

b-fein commented 1 month ago

As long as the publication date is guaranteed to not be used from the old exercise, but either be null, or the one manually defined in the import dialogue I guess this should not be a problem.

Since the importedExercise is probably initialised from the original one: I assume it was easier to ensure no leakage here by setting it to null rather than doing it where the original exercise is sent from the server to the client as required for the import dialogue.