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")
|
@Column(name = "reflection_status")
|
||||||
private ReflectionStatus reflectionStatus = ReflectionStatus.NOT_SUBMITTED;
|
private ReflectionStatus reflectionStatus = ReflectionStatus.NOT_SUBMITTED;
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "reflection_comment_by_supervisor")
|
||||||
|
private String reflectionSupervisorComment;
|
||||||
|
|
||||||
public Project getProject() {
|
public Project getProject() {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
@ -76,6 +80,14 @@ public class Author {
|
|||||||
this.reflectionStatus = reflectionStatus;
|
this.reflectionStatus = reflectionStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setReflectionSupervisorComment(String reflectionSupervisorComment) {
|
||||||
|
this.reflectionSupervisorComment = reflectionSupervisorComment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReflectionSupervisorComment() {
|
||||||
|
return reflectionSupervisorComment;
|
||||||
|
}
|
||||||
|
|
||||||
@Embeddable
|
@Embeddable
|
||||||
public static class AuthorPK implements Serializable {
|
public static class AuthorPK implements Serializable {
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
@ -20,8 +20,9 @@ public interface ReflectionService {
|
|||||||
* This is done individually by author.
|
* This is done individually by author.
|
||||||
*
|
*
|
||||||
* @param author the author whose reflection does not meet the minimum requirements.
|
* @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);
|
Reflection getReflection(Project project, User author);
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,11 @@ class ReflectionServiceImpl implements ReflectionService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void requestNewReflection(Project project, User user) {
|
public void requestNewReflection(Project project, User user, String supervisorComment) {
|
||||||
authorRepository.findByProjectAndUser(project, user)
|
authorRepository.findByProjectAndUser(project, user)
|
||||||
.ifPresent(author -> {
|
.ifPresent(author -> {
|
||||||
author.setReflectionStatus(ReflectionStatus.IMPROVEMENTS_NEEDED);
|
author.setReflectionStatus(ReflectionStatus.IMPROVEMENTS_NEEDED);
|
||||||
|
author.setReflectionSupervisorComment(supervisorComment);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +75,9 @@ class ReflectionServiceImpl implements ReflectionService {
|
|||||||
private Reflection toReflection(Author author) {
|
private Reflection toReflection(Author author) {
|
||||||
return switch (author.getReflectionStatus()) {
|
return switch (author.getReflectionStatus()) {
|
||||||
case SUBMITTED -> new Reflection.Submitted(author.getReflection());
|
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();
|
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),
|
assertFalse(reflectionService.hasToFillInReflection(project, author),
|
||||||
"After submitting the initial reflection it should no longer be required");
|
"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),
|
assertTrue(reflectionService.hasToFillInReflection(project, author),
|
||||||
"After supervisor requests resubmission the author should now be required to submit a new reflection");
|
"After supervisor requests resubmission the author should now be required to submit a new reflection");
|
||||||
assertEquals(myReflection, reflectionService.getSubmittedReflection(project, author),
|
assertEquals(myReflection, reflectionService.getSubmittedReflection(project, author),
|
||||||
|
@ -74,7 +74,9 @@ class ReflectionModalBodyPanel extends Panel {
|
|||||||
|
|
||||||
IModel<String> commentModel = new Model<>();
|
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") {
|
add(new AjaxSubmitLink("submit") {
|
||||||
@Override
|
@Override
|
||||||
@ -83,7 +85,8 @@ class ReflectionModalBodyPanel extends Panel {
|
|||||||
|
|
||||||
reflectionService.requestNewReflection(
|
reflectionService.requestNewReflection(
|
||||||
projectModel.getObject(),
|
projectModel.getObject(),
|
||||||
authorModel.getObject());
|
authorModel.getObject(),
|
||||||
|
commentModel.getObject());
|
||||||
|
|
||||||
target.add(ReflectionModalBodyPanel.this);
|
target.add(ReflectionModalBodyPanel.this);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user