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
7 changed files with 32 additions and 2 deletions
Showing only changes of commit 2ae764a0ad - Show all commits

View File

@ -20,7 +20,7 @@ public class ProjectEvent extends NotificationEvent {
ROUGH_DRAFT_APPROVAL_APPROVED, ROUGH_DRAFT_APPROVAL_REJECTED, REVIEWER_GRADING_REPORT_SUBMITTED,
ONE_YEAR_PASSED_FROM_LATEST_ANNUAL_REVIEW, SUPERVISOR_GRADING_INITIAL_ASSESSMENT_DONE,
EXPORTED_SUCCESS, REVIEWER_GRADING_INITIAL_ASSESSMENT_DONE, FIRST_MEETING, OPPOSITION_FAILED, PARTICIPATION_APPROVED, COMPLETED,
REFLECTION_IMPROVEMENTS_REQUESTED, PARTICIPATION_FAILED
REFLECTION_IMPROVEMENTS_REQUESTED, REFLECTION_IMPROVEMENTS_SUBMITTED, PARTICIPATION_FAILED
}
@ManyToOne

View File

@ -89,6 +89,9 @@ PROJECT.REFLECTION_IMPROVEMENTS_REQUESTED.title = Reflection improvements reques
PROJECT.REFLECTION_IMPROVEMENTS_REQUESTED.body = The supervisor has deemed that the reflection submitted does not meet \
the minimum requirements and has requested improvements. Please log into SciPro and submit a new reflection. \
Their comments can be seen below:\n\n{0}
PROJECT.REFLECTION_IMPROVEMENTS_SUBMITTED.title = Reflection improvements submitted
PROJECT.REFLECTION_IMPROVEMENTS_SUBMITTED.body = The reflection improvements have been submitted. \
\n\n{0}
FORUM.NEW_FORUM_POST.title = Forum post: {2}
FORUM.NEW_FORUM_POST.body = New forum post submitted:<br /><br />{0}

View File

@ -0,0 +1,10 @@
package se.su.dsv.scipro.reflection;
import se.su.dsv.scipro.project.Project;
import se.su.dsv.scipro.system.User;
/**
* This event may be triggered by the supervisor if they edit the reflection after requesting improvements.
*/
public record ReflectionImprovementsSubmittedEvent(Project project, User author, String reflection) {
}

View File

@ -50,6 +50,9 @@ class ReflectionServiceImpl implements ReflectionService {
public void submitReflection(Project project, User user, String reflection) {
authorRepository.findByProjectAndUser(project, user)
.ifPresent(author -> {
if (author.getReflectionStatus() == ReflectionStatus.IMPROVEMENTS_NEEDED) {
eventBus.post(new ReflectionImprovementsSubmittedEvent(project, user, reflection));
}
author.setReflection(reflection);
author.setReflectionStatus(ReflectionStatus.SUBMITTED);
});

View File

@ -8,6 +8,7 @@ import se.su.dsv.scipro.notifications.NotificationController;
import se.su.dsv.scipro.notifications.dataobject.NotificationSource;
import se.su.dsv.scipro.notifications.dataobject.ProjectEvent;
import se.su.dsv.scipro.reflection.ReflectionImprovementsRequestedEvent;
import se.su.dsv.scipro.reflection.ReflectionImprovementsSubmittedEvent;
import java.util.Set;
@ -30,4 +31,16 @@ public class NotifyFailedReflection {
source,
Set.of(new Member(event.author(), Member.Type.AUTHOR)));
}
@Subscribe
public void reflectionImprovementsSubmittted(ReflectionImprovementsSubmittedEvent event) {
NotificationSource source = new NotificationSource();
source.setMessage(event.reflection());
source.setAdditionalMessage(event.author().getFullName());
notificationController.notifyCustomProject(
event.project(),
ProjectEvent.Event.REFLECTION_IMPROVEMENTS_SUBMITTED,
source,
Set.of(new Member(event.project().getHeadSupervisor(), Member.Type.SUPERVISOR)));
}
}

View File

@ -158,7 +158,7 @@ public class NotificationLandingPage extends WebPage {
setResponsePage(RoughDraftApprovalDecisionPage.class, reviewerParameters);
}
break;
case REVIEWER_GRADING_INITIAL_ASSESSMENT_DONE, REVIEWER_GRADING_REPORT_SUBMITTED:
case REVIEWER_GRADING_INITIAL_ASSESSMENT_DONE, REVIEWER_GRADING_REPORT_SUBMITTED, REFLECTION_IMPROVEMENTS_SUBMITTED:
if (project.isSupervisor(currentUser)) {
setResponsePage(SupervisorGradingReportPage.class, pp);
}

View File

@ -66,6 +66,7 @@ ProjectEvent.OPPOSITION_FAILED = An author fails their opposition.
ProjectEvent.PARTICIPATION_APPROVED = An author's active participation is approved.
ProjectEvent.PARTICIPATION_FAILED = An author fails their active participation.
ProjectEvent.REFLECTION_IMPROVEMENTS_REQUESTED = Reflection improvements requested.
ProjectEvent.REFLECTION_IMPROVEMENTS_SUBMITTED = Reflection improvements submitted.
ProjectForumEvent.NEW_FORUM_POST = Forum thread created.
ProjectForumEvent.NEW_FORUM_POST_COMMENT = Comment posted in forum thread.