Allow changes to the reflection to be made after it's been submitted #13
@ -44,6 +44,10 @@ public class Author {
|
||||
@Column(name = "reflection_status")
|
||||
private ReflectionStatus reflectionStatus = ReflectionStatus.NOT_SUBMITTED;
|
||||
|
||||
@Basic
|
||||
@Column(name = "reflection_comment_by_supervisor")
|
||||
private String reflectionSupervisorComment;
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
@ -76,6 +80,14 @@ public class Author {
|
||||
this.reflectionStatus = reflectionStatus;
|
||||
}
|
||||
|
||||
public void setReflectionSupervisorComment(String reflectionSupervisorComment) {
|
||||
this.reflectionSupervisorComment = reflectionSupervisorComment;
|
||||
}
|
||||
|
||||
public String getReflectionSupervisorComment() {
|
||||
return reflectionSupervisorComment;
|
||||
}
|
||||
|
||||
@Embeddable
|
||||
public static class AuthorPK implements Serializable {
|
||||
private Long projectId;
|
||||
|
@ -20,8 +20,9 @@ public interface ReflectionService {
|
||||
* This is done individually by author.
|
||||
*
|
||||
* @param author the author whose reflection does not meet the minimum requirements.
|
||||
* @param supervisorComment feedback provided by the supervisor so the author knows what to improve.
|
||||
*/
|
||||
void requestNewReflection(Project project, User author);
|
||||
void requestNewReflection(Project project, User author, String supervisorComment);
|
||||
|
||||
Reflection getReflection(Project project, User author);
|
||||
}
|
||||
|
@ -57,10 +57,11 @@ class ReflectionServiceImpl implements ReflectionService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void requestNewReflection(Project project, User user) {
|
||||
public void requestNewReflection(Project project, User user, String supervisorComment) {
|
||||
authorRepository.findByProjectAndUser(project, user)
|
||||
.ifPresent(author -> {
|
||||
author.setReflectionStatus(ReflectionStatus.IMPROVEMENTS_NEEDED);
|
||||
author.setReflectionSupervisorComment(supervisorComment);
|
||||
});
|
||||
}
|
||||
|
||||
@ -74,7 +75,9 @@ class ReflectionServiceImpl implements ReflectionService {
|
||||
private Reflection toReflection(Author author) {
|
||||
return switch (author.getReflectionStatus()) {
|
||||
case SUBMITTED -> new Reflection.Submitted(author.getReflection());
|
||||
case IMPROVEMENTS_NEEDED -> new Reflection.ImprovementsNeeded(author.getReflection(), "");
|
||||
case IMPROVEMENTS_NEEDED -> new Reflection.ImprovementsNeeded(
|
||||
author.getReflection(),
|
||||
author.getReflectionSupervisorComment());
|
||||
default -> new Reflection.NotSubmitted();
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
ALTER TABLE `project_user` ADD COLUMN `reflection_comment_by_supervisor` TEXT NULL;
|
@ -114,7 +114,7 @@ public class ReflectionServiceTest extends IntegrationTest {
|
||||
assertFalse(reflectionService.hasToFillInReflection(project, author),
|
||||
"After submitting the initial reflection it should no longer be required");
|
||||
|
||||
reflectionService.requestNewReflection(project, author);
|
||||
reflectionService.requestNewReflection(project, author, "Very bad reflection");
|
||||
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),
|
||||
|
@ -74,7 +74,9 @@ class ReflectionModalBodyPanel extends Panel {
|
||||
|
||||
IModel<String> commentModel = new Model<>();
|
||||
|
||||
add(new TextArea<>("comment", commentModel));
|
||||
TextArea<String> comment = new TextArea<>("comment", commentModel);
|
||||
comment.setRequired(true);
|
||||
add(comment);
|
||||
|
||||
add(new AjaxSubmitLink("submit") {
|
||||
@Override
|
||||
@ -83,7 +85,8 @@ class ReflectionModalBodyPanel extends Panel {
|
||||
|
||||
reflectionService.requestNewReflection(
|
||||
projectModel.getObject(),
|
||||
authorModel.getObject());
|
||||
authorModel.getObject(),
|
||||
commentModel.getObject());
|
||||
|
||||
target.add(ReflectionModalBodyPanel.this);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user