Allow changes to the reflection to be made after it's been submitted #13

Merged
ansv7779 merged 20 commits from 3412-supervisor-edit-reflection into develop 2024-11-21 19:20:48 +01:00
3 changed files with 33 additions and 0 deletions
Showing only changes of commit a855218d48 - Show all commits

View File

@ -14,4 +14,12 @@ public interface ReflectionService {
* @return the reflection, or {@code null} if none has been submitted
*/
String getSubmittedReflection(Project project, User author);
/**
* Used by the supervisor when the currently submitted reflection does not meet the minimum requirements.
* This is done individually by author.
*
* @param author the author whose reflection does not meet the minimum requirements.
*/
void requestNewReflection(Project project, User author);
}

View File

@ -45,4 +45,9 @@ class ReflectionServiceImpl implements ReflectionService {
.map(Author::getReflection)
.orElse(null);
}
@Override
public void requestNewReflection(Project project, User author) {
}
}

View File

@ -101,6 +101,26 @@ public class ReflectionServiceTest extends IntegrationTest {
assertTrue(reflectionService.hasReachedReflectionProcess(project));
}
@Test
public void request_resubmission() {
LocalDate seminarDate = scheduleSeminar();
clock.setDate(seminarDate.plusDays(1));
assertTrue(reflectionService.hasToFillInReflection(project, author),
"After the final seminar the author should be required to submit a reflection");
String myReflection = "my reflection";
reflectionService.submitReflection(project, author, myReflection);
assertEquals(myReflection, reflectionService.getSubmittedReflection(project, author));
assertFalse(reflectionService.hasToFillInReflection(project, author),
"After submitting the initial reflection it should no longer be required");
reflectionService.requestNewReflection(project, author);
assertTrue(reflectionService.hasToFillInReflection(project, author),
"After supervisor requests resubmission the author should now be required to submit a new reflection");
assertEquals(myReflection, reflectionService.getSubmittedReflection(project, author),
"The old reflection should be saved to make it easier for the student to update it");
}
private LocalDate scheduleSeminar() {
project.setFinalSeminarRuleExempted(true); // to bypass rough draft approval
FinalSeminarDetails details = new FinalSeminarDetails("Zoom", false, 1, 1, Language.SWEDISH, Language.ENGLISH, "zoom id 123");